Re: [stella] signed 8-bit comparisons?

Subject: Re: [stella] signed 8-bit comparisons?
From: KirkIsrael@xxxxxxxxxxxxx
Date: 4 Mar 2004 13:11:46 -0000
> See

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

 "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
Unsub & more at

Current Thread