Mooneye GB is a Game Boy research project and emulator written in Rust.
The main goals of this project are accuracy and documentation. Some existing emulators are very accurate (Gambatte, BGB >= 1.5) but are not documented very clearly, so they are not that good references for emulator developers. I want this project to document as clearly as possible why certain behaviour is emulated in a certain way. This also means writing a lot of test ROMs to figure out corner cases and precise behaviour on real hardware.
For documentation about known behaviour, see Game Boy: Complete Technical Reference
Looking for the mooneye-gb test ROMs? They are now part of Mooneye Test Suite.
Non-goals:
- CGB (Game Boy Color) support. It would be nice, but I want to make the normal Game Boy support extremely robust first.
- A debugger
- A good user interface. Building native UIs with Rust is a bit painful at the moment.
Warning:
- Project is WIP
- Doesn't work properly without a boot ROM
- The emulator is lagging behind hardware research. I don't want to spend time making short-lived and probably incorrect fixes to the emulator if I'm not sure about the hardware behaviour.
Always compile in release mode if you care about performance!
On a i7-3770K desktop machine I can usually run ROMs with 2000 - 4000% speed. Without optimizations the speed drops to 150 - 200%, which is still fine for development purposes.
Raspberry Pi with X11 desktop works but is too slow because there is no OpenGL acceleration.
The emulator is runnable on Android, but cross-compiling and packaging is a huge pain and touch controls would have to be implemented, so I'm not supporting Android at the moment.
Requirements:
- Rust 1.26
- SDL2 development libraries for your platform must be installed
cargo run --release
- Follow the instructions
- Acquire a Game Boy bootrom, and put it to
$HOME/.local/share/mooneye-gb/bootroms/dmg_boot.bin
cargo build --release
cargo run --release -- PATH_TO_GAMEBOY_ROM
On Windows, also download an SDL2 package containing SDL2.dll, and put it to
target/debug
and target/release
.
Game Boy | Key |
---|---|
Dpad | Arrow keys |
A | Z |
B | X |
Start | Return |
Select | Backspace |
Function | Key |
---|---|
Fast forward | Shift |
Toggle performance overlay | F2 |
Test | mooneye-gb |
---|---|
cpu instrs | π |
dmg sound 2 | β |
instr timing | π |
mem timing 2 | π |
oam bug 2 | β |
cgb sound 2 |
Notes:
- cpu_instrs fails on MGB/SGB2 hardware and emulators emulating them correctly. The ROM incorrectly detects the device as CGB, and attempts to perform a CPU speed change which causes a freeze (STOP instruction with joypad disabled)
- dmg_sound-2 test #10 can fail randomly on real hardware and seems to depend on non-deterministic behaviour.
- oam_bug-2 fails on all CGB, AGB, and AGS devices
- cgb_sound-2 test #03 fails on CPU CGB, CPU CGB A, and CPU CGB B
Test | mooneye-gb |
---|---|
add sp e timing | π |
boot div dmg0 | β |
boot div dmgABCmgb | β |
boot div S | β |
boot div2 S | β |
boot hwio dmg0 | β |
boot hwio dmgABCmgb | β |
boot hwio S | π |
boot regs dmg0 | π |
boot regs dmgABC | π |
boot regs mgb | π |
boot regs sgb | π |
boot regs sgb2 | π |
call timing | π |
call timing2 | π |
call cc_timing | π |
call cc_timing2 | π |
di timing GS | π |
div timing | π |
ei sequence | π |
ei timing | π |
halt ime0 ei | π |
halt ime0 nointr_timing | π |
halt ime1 timing | π |
halt ime1 timing2 GS | π |
if ie registers | π |
intr timing | π |
jp timing | π |
jp cc timing | π |
ld hl sp e timing | π |
oam dma_restart | π |
oam dma start | π |
oam dma timing | π |
pop timing | π |
push timing | π |
rapid di ei | π |
ret timing | π |
ret cc timing | π |
reti timing | π |
reti intr timing | π |
rst timing | π |
Test | mooneye-gb |
---|---|
mem oam | π |
reg f | π |
unused_hwio GS | π |
Test | mooneye-gb |
---|---|
daa | π |
Test | mooneye-gb |
---|---|
ie push | π |
Test | mooneye-gb |
---|---|
basic | π |
reg_read | π |
sources GS | π |
Test | mooneye-gb |
---|---|
hblank ly scx timing GS | π |
intr 1 2 timing GS | π |
intr 2 0 timing | π |
intr 2 mode0 timing | π |
intr 2 mode3 timing | π |
intr 2 oam ok timing | π |
intr 2 mode0 timing sprites | β |
lcdon timing GS | β |
lcdon write timing GS | β |
stat irq blocking | β |
stat lyc onoff | β |
vblank stat intr GS | π |
Test | mooneye-gb |
---|---|
boot sclk align dmgABCmgb | β |
Test | mooneye-gb |
---|---|
div write | π |
rapid toggle | π |
tim00 div trigger | π |
tim00 | π |
tim01 div trigger | π |
tim01Β | π |
tim10 div trigger | π |
tim10 | π |
tim11 div trigger | π |
tim11 | π |
tima reload | π |
tima write reloading | π |
tma write reloading | π |
Test | mooneye-gb |
---|---|
bits bank1 | π |
bits bank2 | π |
bits mode | π |
bits ramg | π |
rom 512kb | π |
rom 1Mb | π |
rom 2Mb | π |
rom 4Mb | π |
rom 8Mb | π |
rom 16Mb | π |
ram 64kb | π |
ram 256kb | π |
multicart rom 8Mb | π |
Test | mooneye-gb |
---|---|
bits ramg | π |
bits romb | π |
bits unused | π |
rom 512kb | π |
rom 1Mb | π |
rom 2Mb | π |
ram | π |
Test | mooneye-gb |
---|---|
rom 512kb | π |
rom 1Mb | π |
rom 2Mb | π |
rom 4Mb | π |
rom 8Mb | π |
rom 16Mb | π |
rom 32Mb | π |
rom 64Mb | π |
Test | mooneye-gb |
---|---|
sprite priority | π |
Test | mooneye-gb |
---|---|
boot div A | |
boot div cgb0 | |
boot div cgbABCDE | |
boot hwio C | |
boot regs A | |
boot regs cgb |
Test | mooneye-gb |
---|---|
unused hwio C |
Test | mooneye-gb |
---|---|
vblank stat intr C |
Mooneye GB is licensed under GPLv3+. Copyright (C) 2014-2020 Joonas Javanainen [email protected]