
Space Invaders ROM by David Winter
A small CHIP-8 interpreter written in C++, rendered with SDL3. A hobby project for the fun of writing an emulator from scratch — complete with a Game Boy-style green color scheme for the nostalgic feel :)
Get a game running in four steps:
-
Clone the repository and enter it:
git clone https://github.com/itsnotsherm/chipate.git cd chipate -
Configure the build — this also pulls in Catch2 for the tests:
cmake -B build
-
Build the interpreter:
cmake --build build
-
Run a ROM:
./build/chipate <ROM file>
That's it — press Esc or close the window to quit. See
Controls for the keypad layout and Tests for running
the unit tests.
src/— the interpreter core (chip8.cpp/chip8.hpp) and the SDL frontend (main.cpp)tests/— unit tests for the CPU core (Catch2)vendored/SDL— a bundled copy of SDL3, so there's nothing extra to install
- A C++17 compiler
- CMake 3.22 or newer
SDL3 is vendored in vendored/SDL, so it builds along with the project — no
separate install needed.
cmake -B build
cmake --build buildThe chipate executable is placed in build/.
Pass a ROM file as the only argument:
./build/chipate roms/space_invaders.ch8Press Esc (or close the window) to quit.
CHIP-8 uses a 16-key hex keypad, mapped to the left side of a QWERTY keyboard:
CHIP-8 Keyboard
1 2 3 C 1 2 3 4
4 5 6 D Q W E R
7 8 9 E A S D F
A 0 B F Z X C V
The mapping is by physical key position, not by the letter printed on the key. chipate reads scancodes rather than characters, the layout above holds on a QWERTY board, and on other layouts (AZERTY, Dvorak, etc.) those same physical positions are used regardless of what letters they produce. Do refer to a keyboard layout comparison if needed! :)
Tests build by default. To run them:
cmake --build build
ctest --test-dir buildYou can turn the test build off with -DCHIPATE_BUILD_TESTS=OFF. Catch2 is
fetched automatically by CMake when tests are enabled.
Ideas I'd like to explore in the future for this interpreter:
- Audio: the sound timer logic has already been written and ticking in the core; would do some audio programming in SDL3 to make this complete.
- ROM selection: a menu to browse and load ROMs from a directory instead of passing a path on the command line.
- Configurable speed: a way to tune the instructions-per-frame to the user's preference.
- Adjustable color themes: a way to add preset/custom color themes to switch between to the user's preference.
- Any other suggestions: I am open to any suggestions that could make this project more fun, do create an issue or reach out to me! :)
Guides and resources I found useful while building chipate:
- Cowgod's Chip-8 Technical Reference
- Guide to making a CHIP-8 emulator by Tobias V. Langhoff
- SDL3 Documentation
MIT — see LICENSE.