Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

c8 Emulator

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.

image image image

Features

  • 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

Requirements

  • gcc
  • make
  • 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

Build the emulator with the default dynamic link setup:

make

To build against the static raylib archive instead:

make LINK=static

For a debug build with symbols and AddressSanitizer enabled:

make DEBUG=1

Clean the binary with:

make clean

Run

The 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" 20

The 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.

Controls

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

ROMs

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.

Notes

  • The CHIP-8 screen is 64x32 pixels internally and scaled up by 20x in the window.
  • Sound playback uses assets/beep.wav.
  • The window title is set to the ROM filename you launch.

About

Chip 8 - Emulator

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages