Re: ELKS port of Adventure - help needed :)

Richard Wallman
2002-12-11T22:22:13Z

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.

I think on line 142 of libc/string/string.c:

sbb ax,ax ; Collect correct val (-1,1).

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.

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. :)

--
Richard Wallman