c8 is a CHIP-8 emulator written in C and rendered with raylib. It loads a CHIP-8 ROM, executes a configurable number of instructions per frame, and draws the 64x32 monochrome display in a scaled window with sound support.
- CHIP-8 CPU, memory, stack, timers, graphics, and keypad state
- Raylib window rendering at 60 FPS
- Keyboard input mapped to the standard CHIP-8 hex keypad layout
- Beep sound playback when the sound timer reaches zero
- See CHIP-8 ROMs for testing
gccmake- raylib libraries in
lib/ - X11, OpenGL, pthread, dl, and rt development/runtime support on Linux
The repository already includes the required raylib binaries in lib/ and the beep sound in assets/beep.wav.
Build the emulator with the default dynamic link setup:
makeTo build against the static raylib archive instead:
make LINK=staticFor a debug build with symbols and AddressSanitizer enabled:
make DEBUG=1Clean the binary with:
make cleanThe emulator expects a ROM path and an instruction batch count:
./c8_emulator <ROM_PATH> <INSTRUCTION_BATCH_COUNT>Examples:
./c8_emulator "chip8-roms/games/Pong (alt).ch8" 10
./c8_emulator "chip8-roms/games/Space Invaders [David Winter].ch8" 20The batch count controls how many CHIP-8 instructions are executed per frame. Higher values run the ROM faster; if you pass 0 or a negative number, the emulator falls back to 10.
The emulator uses the standard CHIP-8 keypad mapping:
| CHIP-8 | Keyboard |
|---|---|
| 1 | 1 |
| 2 | 2 |
| 3 | 3 |
| C | 4 |
| 4 | Q |
| 5 | W |
| 6 | E |
| D | R |
| 7 | A |
| 8 | S |
| 9 | D |
| E | F |
| A | Z |
| 0 | X |
| B | C |
| F | V |
The chip8-roms/ directory includes a curated set of demo and game ROMs for testing the emulator. These ROMs are provided for convenience; check the individual files for their original authors and licensing notes.
- The CHIP-8 screen is 64x32 pixels internally and scaled up by
20xin the window. - Sound playback uses
assets/beep.wav. - The window title is set to the ROM filename you launch.