lion icon indicating copy to clipboard operation
lion copied to clipboard

Chip-8 Emulator written in Zig

logo Lion

Lion is a CHIP-8 emulator written in Zig. It uses OpenGL with GLFW for rendering and OpenAL for audio support. The keypad uses the original keypad and can currently not be customized. Meaning the following keys are available:

1 | 2 | 3 | C

4 | 6 | 7 | D

7 | 8 | 9 | E

A | 0 | B | F

It also supports the following keys:

  • Esc: Closes the window
  • P: Pauses the cpu
  • M: Mutes the audio

Running rom's

To run the example rom you can use

> zig build run

To use your own rom:

> zig build
> ./zig-cache/bin/lion <path_to_rom>

Currently I've only been testing on Linux. Adding support to Windows/MacOS should be fairly simple by modifying the build.zig file (as long as MacOS still supports OpenGL).

Dependencies

credits

  • Audio source: https://audiosoundclips.com/8-bit-game-sound-effects-sfx/ (Game Effect 10).
  • Test ROM: https://github.com/corax89/chip8-test-rom
  • Original logo: https://github.com/ziglang/logo

references

  1. Mastering CHIP-8
  2. Cowgod's Chip-8 Technical Reference v1.0
  3. Building a Chip-8 Emulator