Re: Re: [stella] signed 8-bit comparisons?

Subject: Re: Re: [stella] signed 8-bit comparisons?
From: KirkIsrael@xxxxxxxxxxxxx
Date: 4 Mar 2004 21:28:59 -0000
> Hi there,
> 
> > I think what you want is:
> >     LDA    var
> >     CMP    #MAX
> >     BMI    ltMAX
> >     LDA    #MAX
> > ltMAX
> >     CMP    #MIN
> >     BPL    gtMIN
> >     LDA    #MIN
> > gtMIN
> >     STA    var
> 
> Wouldn't it be better to use bcc and bcs instead of bmi and bpl?

If I'm reading 
http://www.6502.org/tutorials/compare_instructions.html
correctly, bcc/bcs vs bmi/bpl is the whole point of my 
question and Eric's response: bcc/bcs work if you're 
treating your 8-bits as an unsigned byte, but if you
want your %11111111 to come across as LESS than your
%00000001, (ala 2's complement) then the code above is 
correct.


-- 
KirkIsrael@xxxxxxxxxxxxx    http://kisrael.com
THE LIVING END Before long the end / Of the beginning / Begins to bend
To the beginning / Of the end you live / With some misgivings
About what you did.  --Samuel Menashe


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


Current Thread