[stella] Re: some little 6502 questions

Subject: [stella] Re: some little 6502 questions
From: jimn8@xxxxxxxxxx (Jim Nitchals)
Date: Fri, 28 Mar 1997 15:10:24 -0800 (PST)
> 
> AND	#%01111111	; this should mask off the sign bit
> 			; note that abs(-128) would be 0 using this method

Won't work for absolute values.  $FD is -3, but $7D is 125 when masked.

How about:

 TAX
 LDA ABSVALUE,X

for a total of 6 cycles, at a cost of 256 bytes of ROM (less if the value
is known to be smaller than +/- 128).

Hey, if it's essential to the inner display loop, just do it.

> > ...and a better way to check when A is between two values (#amin <= A < #amax):
> 
> Can't help here...

Neither can I.  Two CMP's are the best solution.

- Jim


--
Archives available at http://www.biglist.com/lists/stella/archives/
E-mail UNSUBSCRIBE in the body to stella-request@xxxxxxxxxxx to be removed.

Current Thread