A simple GB emulator.
- Cycle accurate, passes many timing tests (see below)
- Supports MBC1, MBC1M, MMM01, MBC2, MBC3, MBC5 and HuC1
- Save/load battery backup
- Save/load emulator state to file
- Fast-forward, pause and step one frame
- Disable/enable each audio channel
- Disable/enable BG, Window and Sprite layers
- Convenient Python test harness using hashes to validate
- (WIP) Debugger with various visualizations (see below)
Requires CMake and SDL2. Debugger uses dear imgui, (included as a git submodule).
If you run make, it will run CMake for you and put the output in the bin/
directory.
$ make
$ bin/binjgb foo.gb
You can also just use cmake directly:
$ mkdir build
$ cd build
$ cmake ..
$ make
When building on Windows, you'll probably have to set the SDL2 directory:
> mkdir build
> cd build
> cmake .. -G "Visual Studio 14 2015" -DSDL2_ROOT_DIR="C:\path\to\SDL\"
Then load this solution into Visual Studio and build it. Make sure to build the
INSTALL target, so the exectuables are built to the bin directory.
You can build binjgb as a WebAssembly module. You'll need an incoming build of emscripten. See https://github.com/kripken/emscripten/wiki/WebAssembly and http://kripken.github.io/emscripten-site/docs/building_from_source/index.html#installing-from-source.
Put a symlink to Emscripten in the emscripten directory, then run make.
$ ln -s ${PATH_TO_EMSCRIPTEN} emscripten
$ make wasm
$ bin/binjgb <filename>
$ bin/binjgb-debugger <filename>
Keys:
| Action | Key |
|---|---|
| DPAD-UP | ↑ |
| DPAD-DOWN | ↓ |
| DPAD-LEFT | ← |
| DPAD-RIGHT | → |
| B | Z |
| A | X |
| START | Enter |
| SELECT | Backspace |
| Quit | Esc |
| Save state | F6 |
| Load state | F9 |
| Toggle fullscreen | F11 |
| Disable audio channel 1-4 | 1-4 |
| Disable BG layer | B |
| Disable Window layer | W |
| Disable OBJ (sprites) | O |
| Fast-forward | Tab |
| Pause | Space |
| Step one frame | N |
You'll have to get the various test suites below, build the .gb files if
necessary, and copy the results to the appropriate directories. See
scripts/tester.py for the expected locations. Probably should write a script
that does this automatically.
scripts/tester.py will only run the tests that match a filter passed on the
command line. Some examples:
# Run all tests
$ scripts/tester.py
# Run all tests mooneye tests
$ scripts/tester.py mooneye
# Run all gpu tests
$ scripts/tester.py gpu











