Can't figure out post-indexed indirect addressing

Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.

Moderator: Moderators

Post Reply
User avatar
raydempsey
Posts: 160
Joined: Sat May 31, 2014 4:12 pm

Can't figure out post-indexed indirect addressing

Post by raydempsey »

LDA #$FF
STA $E704

LDA #$04
STA $A0
LDA #$E7
STA $A1

LDY #$00
LDA ($A0),Y
STA $A2

I am hoping that $00A2 will have a value of FF but it is not happening. What am I doing wrong?

-Ray
User avatar
thefox
Posts: 3139
Joined: Mon Jan 03, 2005 10:36 am
Location: Tampere, Finland
Contact:

Re: Can't figure out post-indexed indirect addressing

Post by thefox »

raydempsey wrote:I am hoping that $00A2 will have a value of FF but it is not happening. What am I doing wrong?
Looks correct, except that if you're coding for NES, $E704 is probably ROM and the first write of $FF has no effect.
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi
User avatar
za909
Posts: 229
Joined: Fri Jan 24, 2014 9:05 am
Location: Hungary

Re: Can't figure out post-indexed indirect addressing

Post by za909 »

You're loading a value from $E704, which is part of the cartridge space, so it'll only happen if there's the $FF as a constant at $E704

Code: Select all

.org $E704

  .db $FF
I don't know which assembler you're using, so you might have to change the .db to .byte
Post Reply