106. Rol zero page x

wire ROL Zero Page,X (opcode ``0x36``).

Lesson 106 of 356 · tests/chapter_01_cpu/test_106_ROL_zero_page_x.py

In this step, extend lesson 105 with only the indexed zero-page adapter and dispatch entry.

Complete example implementation in the production locations

`emulator/cpu/opcodes.py::rol_zero_page_x`::

def rol_zero_page_x(cpu: CPU):
    addr = zero_page_x(cpu)
    rol(cpu, addr)

`emulator/cpu/opcodes.py::OPCODE_TABLE`::

0x36: rol_zero_page_x,

Why this step exists

Reuse the established addressing helper so wrapping policy is not duplicated in the instruction primitive.

Invariants: one operand byte is consumed; effective address is `(operand + cpu.x) & 0xFF; PC ends at start+2; rol mutates only that byte with the C/Z/N behavior from lesson 102. Base 0xFE plus X 0x03 therefore targets $0001`.

Misconception: zero-page indexing does not spill into `$0101` and is not 16-bit absolute indexing; wrapping to eight bits is required.

Out of scope: absolute modes are lessons 107-108, ROR starts at 109, and cycle-accurate indexed read/modify/write sequencing is later work.

Run this lesson

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