Skip to main content

Module disasm

Module disasm 

Source
Expand description

6502 disassembler — used by the debugger UI.

Side-effect-free. Takes a peek closure that samples bytes on the CPU bus without advancing time. The output rows are intended for a scrollable listing; the addressing-mode decode is canonical for the 151 documented opcodes plus the handful of unofficial opcodes that ship games actually use. Unknown opcodes render as .byte $XX.

This file is deliberately ~200 LOC: a single static table covers the entire 256-entry opcode space, and one match dispatches by addressing mode. There’s no allocation per-instruction.

Structs§

DisasmLine
One decoded instruction.

Functions§

disassemble_at
Disassemble count instructions starting at pc. peek returns the byte at any CPU bus address without side effects.