209. Nop implied

wire official implied NOP opcode $EA.

Lesson 209 of 356 · tests/chapter_01_cpu/test_209_NOP_implied.py

Why this step exists

In this step, update `emulator/cpu/opcodes.py's instruction import and OPCODE_TABLE; emulator/cpu/instructions.py::nop` already exists from step 208. This mapping permits CPU.step to execute padding in real programs.

Suggested implementation

from emulator.cpu.instructions import nop  # add to the existing import

OPCODE_TABLE = {
    # existing entries
    0xEA: nop,
}

Invariant: $EA is one byte, so a step from $8000 ends at $8001 solely because CPU.step fetched the opcode; registers, S, P, and memory remain unchanged. The common misconception is to increment PC in `nop` or fetch a phantom operand.

Out of scope: unofficial multi-byte NOP opcodes and timing changes belong to later steps. Multi-instruction CPU verification belongs to step 210.

Run this lesson

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