i'm having some trouble with the following code for a 6502 machine:
C000 LDA #$00
C002 STA $FE
C004 LDA #$20
C006 STA $FF
C008 LDY #$08
C00A LDX #$00
C00C DEY
C00D CPY #$FF
C00F BEQ $C01B
C011 LDA ($FE),Y
C013 CMP #$2F
C015 BPL $C00C
C017 INX
C018 JMP $C00C
C01B BRK
The exercise is to store the numbers 2, 1 and 4 starting from the address 2000 and say what are the values of A, X and Y.
I'm "running" my code with pen and paper but I got stuck at C011 for the following reason:LDA ($FE),Y
It loads in A the value stored at the memory address calculated this way:
- pick
$FE
value (that at first is 00) - Add the value of Y (that at first iteration is 7)
- I now have 07
- Load A with the value stored at 07
Is this correct? Am I missing something?
If I'm not, where do I use the values stored in 2000
2001
and 2002
?
Thanks in advance..