202. Txs implied
wire implied TXS opcode $9A.
Lesson 202 of 356 · tests/chapter_01_cpu/test_202_TXS_implied.py
Why this step exists
In this step, the targets are `emulator/cpu/opcodes.py's instruction import and OPCODE_TABLE; emulator/cpu/instructions.py::txs already exists from step 201. The opcode wiring makes that isolated behavior executable through emulator/cpu/cpu.py::CPU.step`.
Suggested implementation
from emulator.cpu.instructions import txs # add to the existing import
OPCODE_TABLE = {
# existing entries
0x9A: txs,
}Invariant: TXS is one byte, so CPU.step's opcode fetch is the only PC advance; dispatch calls `txs(cpu)` directly and preserves X and P. The common misconception is to route implied TXS through an addressing mode and consume the next byte as an operand.
Out of scope: implementing TSX or registering $BA belongs to steps 203-204; cycle accounting and later CPU facilities are not part of this transition.
Run this lesson
uv run pytest tests/chapter_01_cpu/test_202_TXS_implied.py -v