[stella] signed math

Subject: [stella] signed math
From: Glenn Saunders <mos6507@xxxxxxxxxxx>
Date: Wed, 28 Jan 2004 22:41:29 -0800
At 07:10 PM 1/28/2004, you wrote:
    clc
    lda    fracvel
    bmi    .negvel
    adc    fracpos
    sta    fracpos
    lda    intpos
    adc    #0
; check for overflow & jump to staint
.negvel
    adc    fracpos
    sta    fracpos
    lda    intpos
    adc    #-1
; check for underflow & jump to .staint
.staint
    sta    intpos


I'm having a little hard time figuring out how "signed" math works as in this example.

If the number is negative, why do you do an adc instruction instead of a sbc instruction?

Is this example complete or is there something missing?


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


Current Thread