A CHIP-8 emulator written in C++ with SDL2 rendering/input/audio and an in-app debugger overlay.
- 64x32 CHIP-8 display rendering
- 16-key keypad input mapping
- CHIP-8 timers at 60Hz
- Sound timer beep (SDL audio callback)
- Debugger controls:
- Run/Pause
- Step one CPU cycle
- Step one render frame
- Overlay showing memory state
click to see YT demo!
- C++20 compiler
- CMake (3.16+)
- SDL2
- SDL2_ttf
On Ubuntu/Debian:
sudo apt install build-essential cmake libsdl2-dev libsdl2-ttf-devFrom repo root:
cmake -S src -B build
cmake --build build -jUsage:
./build/chip8 <rom_path>example: play pong
./build/chip8 game-roms/pong.ch8I used the most common key mapping based on the guides I referenced
Keyboard->Chip-81 2 3 4->1 2 3 CQ W E R->4 5 6 DA S D F->7 8 9 EZ X C V->A 0 B F
Escquit (kill VM)F1toggle debug overlay panelF2run/pause executionF3step one CPU cycleF4step one render/frame
src/chip8_emulator.*core VM + opcode implementationsrc/graphics.*SDL display and audiosrc/debugger.*debugger functionalitysrc/main.cppgame loop, orchestrationtest-roms/testing ROMs to validate correct instruction handling behaviorsgame-romsa few game ROMS to play around with the VM.fonts/font TTF(s) for debugger panel + any future rendered text features.
- Build a Github Pages/Web deployable setup using WASM etc. Hope to do this soon.
Austin Morlan's chip8_emulator blog : Super detailed notes/guide , heavily referenced the explanations to get started. Implementation isn't perfect but overall really solid piece
-Timendus's chip8-test-suite repo - used to source the chip-8 test ROMs in this repo and iron out my instruction implementations. Super helpful , esp prior to building the debugger.
-kripod's chip8-roms repo - great library of ROMs from all sorts of sources , most should work with this setup! There are a few in this repo as well from there.
Cowgod's chip-8 technical reference - an old school tech breakdown of chip-8. This one was great so I wasn't tempted to look at code (only text explanations). Only complaint is a few of the instruction descriptions will get you in trouble later on with the carry flag if not careful.
