All projects
Systems Programming · 2024
CHIP-8 Emulator in C
A fully functional CHIP-8 emulator written from scratch in C with SDL2 — all 35 opcodes, the classic 64×32 monochrome display, and cycle timing faithful enough to run the original ROM library.
Approach
CHIP-8 is the canonical first emulator, but "simple" still means building a fetch-decode-execute loop, XOR-based sprite rendering with collision detection, delay and sound timers ticking at 60Hz independent of CPU speed, and a 16-key hexadecimal keypad mapped onto a modern keyboard.
It runs Pong, Tetris, Space Invaders, and the rest of the classic ROM set. The emulator mindset — memory maps, registers, instruction semantics — is the same muscle used for reverse engineering and exploitation work.
Highlights
- All 35 CHIP-8 opcodes with correct flag semantics
- XOR sprite rendering with collision flag (the VF register)
- 60Hz delay/sound timers decoupled from instruction rate
- SDL2 graphics, input, and audio