Skip to content

omdxp/chip8

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CHIP-8 Emulator in Zig

A simple CHIP-8 emulator written in Zig, using SDL2 for graphics and keyboard input. This project is intended for learning, experimentation, and playing classic CHIP-8 games.

Features

  • Interprets and runs CHIP-8 ROMs
  • SDL2-based graphics and input
  • Sound support (beep)
  • Command-line interface for loading games
  • Cross-platform (tested on macOS)

Requirements

  • Zig 0.14.0 or newer
  • SDL2 development libraries (dynamically linked)
    • On macOS, you can install SDL2 with Homebrew: brew install sdl2
    • Note: SDL2 must be available as a dynamic library at runtime (e.g., libSDL2.dylib on macOS)

Building

  1. Install Zig and SDL2 (on macOS, use Homebrew):
    brew install zig sdl2
  2. Clone this repository and enter the directory.
  3. Build the emulator:
    zig build

Running

To run a CHIP-8 game:

zig build run -- -p games/PONG

Replace games/PONG with the path to any CHIP-8 ROM in the games/ directory.

Note: SDL2 is dynamically linked. You must have the SDL2 dynamic library (libSDL2.dylib on macOS) available in your system library path. If you get a library not found error, ensure SDL2 is installed and your library path is set correctly.

Controls

  • CHIP-8 keypad is mapped to your keyboard (see main.zig for mapping)
  • ESC or window close to exit

Project Structure

  • src/ — Zig source files
  • games/ — Example CHIP-8 ROMs
  • build.zig — Zig build script

Acknowledgments

License

MIT License. See source files for details.

About

Chip8 Emulator in Zig

Topics

Resources

Stars

Watchers

Forks

Languages