Subject: Re: [stella] signed 8-bit comparisons? From: KirkIsrael@xxxxxxxxxxxxx Date: 4 Mar 2004 13:11:46 -0000 |
> See http://www.6502.org/tutorials/compare_instructions.html Heh-now I don't feel *quite* so bad with my struggles with comparisons given that I see that one of *only* two tutorials at 6502.org is dedicated to the topic. (And by playing around with that 6502 emulator, I did realize on my own that the code I was trying to cut and paste and mangle was probably for signed only) > I think what you want is: > LDA var > CMP #MAX > BMI ltMAX > LDA #MAX > ltMAX > CMP #MIN > BPL gtMIN > LDA #MIN > gtMIN > STA var That seems to work. I don't need to clear carry or anything. (Oh. I see there is no "clear minus" instruction anyway. I guess the LDA will always set that, but not the carry. I guess a sharper 6502 programmer would know that pretty much instantly...) Thank you! -- KirkIsrael@xxxxxxxxxxxxx http://kisrael.com "How do we stop an elephant if it goes berserk? What do we do? Do we use an AK-47? An M-16? An AR-15?... Frankly, would that stop an elephant? I really doubt it. Do they have a bazooka?" --US Senator Bob Smith ---------------------------------------------------------------------------------------------- Archives (includes files) at http://www.biglist.com/lists/stella/archives/ Unsub & more at http://www.biglist.com/lists/stella/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [stella] signed 8-bit compariso, Andrew Davie | Thread | Re: [stella] signed 8-bit compariso, Eric Ball |
Re: [stella] signed 8-bit compariso, Andrew Davie | Date | [stella] JoustPong: feedback please, KirkIsrael |
Month |