From: Piotr Fusik (P.Fusik_at_elka.pw.edu.pl)
Date: 2003-10-28 12:08:05
Hi, On Mon, 27 Oct 2003, Ullrich von Bassewitz wrote: > > 2. Signed comparisions can be made unsigned. :-) > [...] > > result2 = (unsigned) (a ^ 0x8000) < (unsigned) (b ^ 0x8000); > > In cases when we didn't use CPX this gives penalty of just one EOR #$80 > > comparing with the old incorrect code or unsigned comparisions. > > The problem is that the high byte is in X, so it's not only the EOR that is > needed but the value has to moved into A for doing so. That's right. I stated that it won't work that good for cases where CPX is used. But generally 16-bit compares are like this: cmp #<value txa sbc #>value So, let's just put an EOR #$80 between TXA and SBC. > And, since A contains the low byte, it has to be saved somewhere. I thought that the result of comparision replaces the current AX value? Bye, Piotr ---------------------------------------------------------------------- To unsubscribe from the list send mail to majordomo_at_musoftware.de with the string "unsubscribe cc65" in the body(!) of the mail.
This archive was generated by hypermail 2.1.3 : 2003-10-28 12:11:27 CET