104. Rol accumulator
expose ROL A as opcode ``0x2A``.
Lesson 104 of 356 · tests/chapter_01_cpu/test_104_ROL_accumulator.py
In this step, after lessons 102-103 define `rol and rol_a`, add the ROL imports needed by opcodes and the accumulator dispatch entry. Later memory modes and ROR remain in their numbered steps.
Suggested implementation in the production locations
`emulator/cpu/opcodes.py` import list gains::
rol, rol_a`emulator/cpu/opcodes.py::OPCODE_TABLE` gains::
0x2A: rol_a,Why this step exists
Accumulator mode needs no adapter because `rol_a(cpu)` already matches the opcode handler signature.
Invariants: fetching `0x2A advances PC once before dispatch; rol_a` consumes no operand, so final PC is start+1, only A is rotated, and its C/Z/N flags retain lesson 103 semantics.
Misconception: do not create an addressing-mode wrapper or call `rol with A. Accumulator mode is one byte and directly maps to rol_a`.
Out of scope: memory opcode adapters `0x26, 0x36, 0x2E, and 0x3E` are lessons 105-108; all ROR dispatch is lesson 111 onward.
Run this lesson
uv run pytest tests/chapter_01_cpu/test_104_ROL_accumulator.py -v