Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indirect indexed addressing: Addresses are not wrapping within zeropage. #55

Open
mibi88 opened this issue Jul 5, 2024 · 0 comments · May be fixed by #56
Open

Indirect indexed addressing: Addresses are not wrapping within zeropage. #55

mibi88 opened this issue Jul 5, 2024 · 0 comments · May be fixed by #56

Comments

@mibi88
Copy link

mibi88 commented Jul 5, 2024

Addresses are not wrapping within zeropage as they do on a real 6502.
When running LDA ($FF), Y with Y = 0, the 6502 simulator takes the low byte from $FF and the high byte from $0100.
It can be seen when running this code:

LDA #$00
STA $00

LDA #$02
STA $FF
LDA #$04
STA $0100

LDA #$AC
STA $0402

LDA #$c2
STA $02

LDY #$00
LDA ($FF), Y

After executing this code, A should be equal to C2 and not AC.
PinoBatch, on the Nesdev wiki figured out that it is due to getWord() which does not handle wrapping:

i11: function () {
var zp = popByte();
var value = memory.getWord(zp) + regY;
regA |= memory.get(value);
ORA();
},

beckadamtheinventor added a commit to beckadamtheinventor/easy6502 that referenced this issue Jul 7, 2024
@beckadamtheinventor beckadamtheinventor linked a pull request Jul 7, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant