Skip to content

IndirectY addressing mode missing page boundary cycle handling #3

Description

@wfd3

Description

The IndirectY (Indirect Indexed) addressing mode doesn't check for page boundary crossings, but according to 6502 specifications, it should add an extra cycle when the indexed address crosses a page boundary.

Location

6502/6502.cc:397-400

Current Code

case AddressingMode::IndirectY:
    address = readByteAtPC();
    address = readWord(address) + Y;
    break;

Expected Behavior

Similar to AbsoluteX and AbsoluteY modes (lines 376-387), the IndirectY mode should:

  1. Check if adding Y to the base address crosses a page boundary
  2. Add an extra cycle if the PageBoundary flag is set for the instruction

Impact

This affects cycle-accurate emulation for instructions using IndirectY addressing mode.

Reference

See how AbsoluteX/AbsoluteY use the updateCycles() lambda to handle this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions