[stella] 6502 basics: signed LSR

Subject: [stella] 6502 basics: signed LSR
From: KirkIsrael@xxxxxxxxxxxxx
Date: 15 Feb 2004 17:41:58 -0000

Is there a better way of dividing a signed 1-byte integer
by 2 than this? (which says, if var is positive, just do LSR,
otherwise LSR and OR w/ -128 i.e. #%10000000 ) It just seems odd
to have to branch to preserve the sign bit but I wasn't clever 
enough to come up with a better way...

	LDA var
	BPL posval
negval
	LSR
	ORA #-128
	JMP done
posval
	LSR
done
	STA var 









-- 
KirkIsrael@xxxxxxxxxxxxx    http://kisrael.com
 The purpose of conversation isn't to demonstrate one's glib intelligence; 
 it's how we stumble and grope our way through the mists and arrive at 
 something like intelligence. --Mr. Blue


----------------------------------------------------------------------------------------------
Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://www.biglist.com/lists/stella/


Current Thread