Emulator Project
Crumb —
CHIP-8 Emulator
A CHIP-8 interpreter built from scratch in C — modeling the virtual machine directly, with registers, memory, a stack, timers, and a function-pointer opcode table driving the fetch-decode-execute cycle at the center of every emulator.
The core of an emulator
Crumb models the CHIP-8 virtual machine directly in C — 16 general-purpose registers, 4KB of memory, a 16-level stack, an index register, and a program counter — and executes original CHIP-8 ROMs instruction by instruction.
The goal was to understand emulation at a low level: how opcodes get decoded, how fonts get memory-mapped, and how the interpreter pattern underneath CHIP-8 generalizes to most virtual machines.
Fetch, decode, execute
Once a ROM is loaded, main.c drives the emulation loop: poll input, run a CPU cycle, render the frame, repeat until the window is closed.
Each cycle, cpuCycle() fetches the next 2-byte opcode from memory at pc, advances the program counter, dispatches to the matching handler via op_table — indexed by the opcode's top nibble — and ticks the delay/sound timers.
Modular by design
The codebase splits CPU emulation from the platform layer, so the opcode logic stays independent of SDL2.
Planned features
Crumb is actively being developed. These two are next on the list.