public inbox for linux-8086@vger.kernel.org
 help / color / mirror / Atom feed
From: Phil Goembel <phil-goembel@wi.rr.com>
To: Richard Wallman <r_wallman@yahoo.co.uk>
Cc: linux-8086@vger.kernel.org
Subject: Re: ELKS port of Adventure - help needed :)
Date: 11 Dec 2002 17:59:56 -0600	[thread overview]
Message-ID: <1039651196.1847.43.camel@Castle.goembel> (raw)
In-Reply-To: <200212112222.gBBMMA5G007271@eddie.loc>

On Wed, 2002-12-11 at 16:22, Richard Wallman wrote:
> On 11 Dec, Richard Wallman wrote:
> 
> > Possible a source code or bcc problem
> 
> It's a bcc problem: strcmp doesn't return the right values.
> 
Yes, I was thinking either a compiler problem or a 
runtime library problem.

I think on line 142 of libc/string/string.c:
> 
> sbb	ax,ax		; Collect correct val (-1,1).
> 
This is suspicious, as I would expect the result to be
either -1 or 0 (I'm not an 8086 assembly guru, though),
depending on the borrow bit.

The borrow bit should be unchanged (I'm assuming the 
8086 arithmetic instructions work like all other 2's 
complement processors I've worked with).

I don't, think after the sbb, that the status bits 
resulting from a compare would be preserved,
i.e. you would not be able to distinguish between a
value being less than, equal, or greater than another
value. The sbb would clobber the status, and just
give greater than or not greater than (borrow or not
borrow).

It's hard to say without seeing the code. If you want
to email me the assembly code, that would help.

> I'm not too hot on x86 assembly, but surely this command is subtracting
> the ax register from itself, using the status flags to show sign? Does
> the processor support a negative and positive zero value?
> 
> The next line (orb al,#1) then turns on bit 1. It is assuming that the
> scasb command has correctly set the right flag to indicate whether the
> comparison was negative or positive, and so give the sign.
> 
Sigh. Guess I'm going to have to set up the ELKS development
environment to help here. If the orb is the very next instruction,
after the sbb, it would change 0 to 1, but leave -1 unchanged.

Where does the scasb fit in?

> I think this is what's wrong - every time, I'm getting a -1 result from
> strcmp.
> 
> 
> 
> Paul: short answer = rewrite strcmp. Only "vocab.c" and "english.c" use
> that function, so just replace all references. sed is your friend. :)

This is a good idea. I'm surprised nobody's run into problems
with strcmp before this, though.

Is strcmp written in assembly, or are you looking at the code
generated by the compiler?

Sorry about asking such basic questions, but it's been a long
time since I've actually tried to set up the ELKS development
environment (and failed). So I don't have the source code
on hand. I've been lurking ever since, but I thought here was 
a simple problem I could help with. Heh!

Phil


  parent reply	other threads:[~2002-12-11 23:59 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-10 13:07 ELKS port of Adventure - help needed :) Paul Nasrat
2002-12-11  8:19 ` Phil Goembel
2002-12-11 21:27   ` Richard Wallman
2002-12-11 22:22     ` Richard Wallman
2002-12-11 22:46       ` Richard Wallman
2002-12-11 22:51       ` Paul Nasrat
2002-12-11 23:59       ` Phil Goembel [this message]
2002-12-12  7:39         ` Paul Nasrat
2002-12-12  8:18           ` Paul Nasrat
2002-12-12 19:11         ` Adventure - the answer to what went wrong? Richard Wallman
2002-12-12 20:21           ` Harry Kalogirou
2002-12-12 20:52           ` Alan Cox
2002-12-12 20:27             ` Dan Olson
2002-12-12 20:29               ` Harry Kalogirou
2002-12-12 20:41                 ` Dan Olson
2002-12-12 21:15               ` Alan Cox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1039651196.1847.43.camel@Castle.goembel \
    --to=phil-goembel@wi.rr.com \
    --cc=linux-8086@vger.kernel.org \
    --cc=r_wallman@yahoo.co.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox