otaleghani/zigboy
A Gameboy (DMG) emulator written in Zig and SDL3. Currently supports ROM-only and MBC1 cartridges.
1994ca5dbad5a3e3c670a9ab8533d86cfd97bdc0
Zigboy is a Gameboy (DMG) emulator written in Zig. It uses the SDL3 library for windowing, input, and audio. It currently supports ROM-only and MBC1 cartridges.
Here is a gallery of the emulator in action, running a few classic titles.
Install Zig (version 0.14.1) and SDL3. If you are using NixOs you could just use the flake.nix
to install dependencies.
git clone https://github.com/otaleghani/zigboy
cd zigboy
nix develop
# Standard build (APU disabled):
zig build
# Build with the (buggy) APU enabled:
zig build -Denable_apu=true
# Build with CPU debug logging for diagnostics:
zig build -Denable_cpu_debug=true
# Build with Gameboy Doctor compatible logging:
zig build -Denable_cpu_debug_gbd=true
# Run the emulator with a path to a Gameboy ROM file:
./zig-out/bin/zigboy path/to/your/rom.gb
The emulator uses the keyboard for input. The default key mappings are:
Keyboard Key | Gameboy Button |
---|---|
W, A, S, D | D-Pad (Up, Left, Down, Right) |
Z | A Button |
X | B Button |
Enter | Start Button |
P | Select Button |
Escape | Quit Emulator |
The emulator is still in an early stage of development. While the goal is broad compatibility, rigorous testing has been focused on a core set of titles.
Confirmed Playable:
Attempting to run other ROMs, especially those using more complex mappers or hitting obscure hardware edge cases, may result in graphical glitches, freezes, or a panic. There are still many bugs to solve, and stability with a wider range of games is a top priority for future development.
This project would not have been possible without the extensive documentation created by the retro-development community. Key resources used during development include:
This project is a work-in-progress. While many games are playable, there are known issues: