Re: [stella] some little 6502 questions (fwd)

Subject: Re: [stella] some little 6502 questions (fwd)
From: Chris Wilkson - MCD <cwilkson@xxxxxxxxxxxxx>
Date: Fri, 28 Mar 1997 13:53:45 -0800 (PST)
> Is there a faster way than this to get the absolute value of the accumulator?
>  
>   (...)
>    
>   BPL plus
>   EOR #$FF
>   CLC
>   ADC #1
> plus:
>   
>   (...)
> 

Piero,

Assuming that you mean A is an 8 bit signed number (-128 to +127), and that
you just want to get rid of the sign, try this:

AND	#%01111111	; this should mask off the sign bit
			; note that abs(-128) would be 0 using this method

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

Can't help here...

-Chris




--
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