139. Eor absolute x

add EOR absolute,X opcode ``0x5D``.

Lesson 139 of 356 · tests/chapter_01_cpu/test_139_EOR_absolute_x.py

Why this step exists

Programs need EOR over full-address data indexed by X; this step connects that effective-address form to the already-tested exclusive-OR semantics.

In this step, lesson 138 supplies unindexed absolute EOR. Add exactly the following to `emulator/cpu/opcodes.py`:

def eor_absolute_x(cpu: CPU):
    addr = absolute_x(cpu)
    value = cpu.bus.read(addr)
    or_e(cpu, value)

OPCODE_TABLE = {
    ...
    0x5D: eor_absolute_x,
}

`emulator/cpu/addressing_modes.py::absolute_x fetches the little-endian base word and then adds X; this helper does not apply an additional & 0xFFFF mask. The handler reads the indexed location and calls instructions.or_e`. A and Z/N may change; Carry/Overflow, memory, X, and Y remain invariant; PC advances three bytes.

Misconception: X indexes the decoded 16-bit address, not its low operand byte. Out of scope: absolute,Y and indirect EOR (140-142) and BIT (143-145).

Run this lesson

uv run pytest tests/chapter_01_cpu/test_139_EOR_absolute_x.py -v