Skip to content

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

Description

@mibi88

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();
},

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions