196. Pla implied

register implied PLA.

Lesson 196 of 356 · tests/chapter_01_cpu/test_196_PLA_implied.py

Prerequisite: step 195 added `pla. In this step, change only emulator/cpu/opcodes.py by importing pla and adding its OPCODE_TABLE` entry.

Why this step exists

PLA's input is the hardware stack selected by S. Opcode $68 has no operand, so `CPU.step() must dispatch directly to pla(cpu)`.

Suggested implementation

from emulator.cpu.instructions import pla

OPCODE_TABLE = {
    # existing entries
    0x68: pla,
}

Invariants: preserve existing mappings; map exactly $68 to `pla`; use no addressing-mode wrapper; consume only the opcode byte; retain step 195's Z/N effects.

Misconception: program memory after $68 does not supply the pulled value; the incremented stack address does.

Out of scope: `pla` behavior is step 195. PHP begins at step 197, and its function and opcode mapping must not be introduced by this transition.

Run this lesson

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