문제

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
도움이 되었습니까?

해결책

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
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top