Frage

I needed to add two 16 bit integers to produce a 16-bit answer using absolute mode addressing. I, however, messed up the memory addresses and can't figure out why. Please advise me on correcting my code:

x1 = $0410
y2 = $0411
s1 = $0412

Start at $0500

CLC             18
LDA     x1      AD  10  04
ADC     y1      6D  11  04
STA     s1      8D  12  04
LDA     x1+1    AD  11  04
ADC     y2+1    6D  12  04
STA     s1+1    8D  13  04
BRK             00
War es hilfreich?

Lösung

As a 16-bit integer takes two bytes, your locations overlap. You need to space them two bytes apart:

x1 = $0410
y2 = $0412
s1 = $0414
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top