Skip to content

leovilok/chip8

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CHIP-8 Emulator

This is a simple C CHIP-8 emulator.

Build

Using SDL2:

# with GNU make
make MEDIA=sdl

# Or directly
cc chip8.c media-sdl.c -o chip8 $(sdl2-config --cflags --libs)

Using Raylib:

# with GNU make
make MEDIA=raylib

# Or directly
cc chip8.c media-raylib.c -o chip8 $(pkg-config --cflags --libs raylib)

Using GLFW and OpenGL ES 2.0 for graphics rendering, and miniaudio for the buzzer:

# with GNU make
make MEDIA=glfw

# Or directly
# with "-lglfw -lGLESv2" for GLFW and OpenGL ES
# and "-ldl -lm -lpthread" for miniaudio on Linux
cc chip8.c media-glfw.c -o chip8 -lglfw -lGLESv2 -ldl -lm -lpthread

Run

Get CHIP-8 roms, for example:

Run the emulator:

./chip8 path/to/rom.c8

Details

  • CHIP-8 pixels are diplayed as 16px × 16px squares on screen (opens a 1024×512 window, resizable only in the GLFW implementation).

  • Background color is pure black, foreground color is pure white.

  • Buzzer uses a 440Hz saw wave.

  • To quit, just close the window (or press Escape using the Raylib implementation).

  • CHIP-8's 4×4 keypad is mapped on these keys:

     ┌───┬───┬───┬───┐
     │ 3 │ 4 │ 5 │ 6 │
     ├───┼───┼───┼───┤
     │ E │ R │ T │ Y │
     ├───┼───┼───┼───┤
     │ D │ F │ G │ H │
     ├───┼───┼───┼───┤
     │ C │ V │ B │ N │
     └───┴───┴───┴───┘
    

Releases

No releases published

Packages

No packages published

Languages