A Gameboy emulator in modern C++
Switch branches/tags
Clone or download



gbemu is a Nintendo Gameboy emulator written in C++. It was written as an exercise (and for fun!) so its goals are exploration of modern C++ and clean code rather than total accuracy.


Building the emulator requires cmake and sfml and has been tested on macOS and Debian. To compile the project, run:

$ make

This builds two versions of the emulator:

  • gbemu - the main emulator, using SFML for graphics and input
  • gbemu-test - a headless version of the emulator for debugging & running tests


usage: gbemu [--debugger] [--trace] [--silent] [--exit-on-infinite-jr] [--print-serial-output] <rom_file>

  --debugger               Enable the debugger
  --exit-on-infinite-jr    Stop emulation if an infinite JR loop is detected
  --print-serial-output    Print data sent to the serial port
  --trace                  Enable trace logging
  --silent                 Disable logging

The key bindings are: , , , , X, Z, Enter, Backspace.


The emulator is tested using Blargg's tests - these can be ran with ./scripts/run_test_roms.

The test it fails is due to the lack of a timer implementation.


Menu Gameplay