Understand the MOS6502 emulator architecture
masterThis emulator uses a jump-table based approach for opcode selection. Instead of a large switch-case block, the opcode value (e.g., 0x80) is used as an index into a table of function pointers. Each entry in the table is a C++ function that emulates a specific instruction.
Key Features:
- 100% coverage of legal opcodes: All 151 valid opcodes are implemented.
- Decimal mode: Supported.
- Addressing modes: All 13 addressing modes (e.g.,
ACCUMULATOR,IMMEDIATE,ABSOLUTE,ZERO PAGE, etc.) are emulated. - Fetch-Decode-Execute loop: The internal loop retrieves the opcode from memory, looks up the instruction in the
InstrTable, and executes it viaExec(instr).