• Stars
    star
    852
  • Rank 53,494 (Top 2 %)
  • Language
    Rust
  • License
    GNU General Publi...
  • Created almost 10 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Game Boy research project and emulator written in Rust

Mooneye GB

Mooneye GB is a Game Boy research project and emulator written in Rust.

Build Status

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.

Performance

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.

Running the emulator

Requirements:

  • Rust 1.26
  • SDL2 development libraries for your platform must be installed

GUI

  1. cargo run --release
  2. Follow the instructions

Command-line

  1. Acquire a Game Boy bootrom, and put it to $HOME/.local/share/mooneye-gb/bootroms/dmg_boot.bin
  2. cargo build --release
  3. 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 keys

Game Boy Key
Dpad Arrow keys
A Z
B X
Start Return
Select Backspace

Other keys

Function Key
Fast forward Shift
Toggle performance overlay F2

Test suite

Blargg's tests

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

Mooneye GB acceptance tests

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 πŸ‘

Bits (unusable bits in memory and registers)

Test mooneye-gb
mem oam πŸ‘
reg f πŸ‘
unused_hwio GS πŸ‘

Instructions

Test mooneye-gb
daa πŸ‘

Interrupt handling

Test mooneye-gb
ie push πŸ‘

OAM DMA

Test mooneye-gb
basic πŸ‘
reg_read πŸ‘
sources GS πŸ‘

PPU

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 πŸ‘

Serial

Test mooneye-gb
boot sclk align dmgABCmgb ❌

Timer

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 πŸ‘

Mooneye GB emulator-only tests

MBC1

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 πŸ‘

MBC2

Test mooneye-gb
bits ramg πŸ‘
bits romb πŸ‘
bits unused πŸ‘
rom 512kb πŸ‘
rom 1Mb πŸ‘
rom 2Mb πŸ‘
ram πŸ‘

MBC5

Test mooneye-gb
rom 512kb πŸ‘
rom 1Mb πŸ‘
rom 2Mb πŸ‘
rom 4Mb πŸ‘
rom 8Mb πŸ‘
rom 16Mb πŸ‘
rom 32Mb πŸ‘
rom 64Mb πŸ‘

Mooneye GB manual tests

Test mooneye-gb
sprite priority πŸ‘

Mooneye GB misc tests

Test mooneye-gb
boot div A
boot div cgb0
boot div cgbABCDE
boot hwio C
boot regs A
boot regs cgb

Bits

Test mooneye-gb
unused hwio C

PPU

Test mooneye-gb
vblank stat intr C

License and copyright

Mooneye GB is licensed under GPLv3+. Copyright (C) 2014-2020 Joonas Javanainen [email protected]

More Repositories

1

gb-schematics

Game Boy -related schematics
386
star
2

gb-ctr

Game Boy: Complete Technical Reference
TeX
292
star
3

gb-hardware

Game Boy -related custom hardware by gekkio
Shell
275
star
4

gb-research

Game Boy hardware research
VHDL
212
star
5

GhidraBoy

Sharp SM83 / Game Boy extension for Ghidra
Kotlin
202
star
6

gnome-session-xmonad

Ubuntu package for Gnome + XMonad session files
Shell
96
star
7

mooneye-test-suite

Mooneye Test Suite is a suite of Game Boy test ROMs
Assembly
62
star
8

gekkio-kicad-libs

KiCad 7.x libraries by gekkio
Python
55
star
9

sbt-jrebel-plugin

JRebel plugin for Simple Build Tool
Scala
36
star
10

gb-hardware-db

Game Boy hardware database
Rust
32
star
11

docker-fpga

Dockerized FPGA toolchain experiments
Shell
21
star
12

lcdoff-rs

Tiny utility to turn off the screen on Windows machines
Rust
15
star
13

samsung-photo-frame-ctrl

A small Python application for controlling Samsung photo frames
Python
11
star
14

robotic-chameleon

Android Java library for YUV scaling and conversion
Java
9
star
15

gb-cartpp

GB-CARTPP-XC/DIY cartridge flasher/dumper firmware/hardware/software
C
8
star
16

gb-cart256k-a

GB-CART256K-A flash cart firmware
VHDL
7
star
17

sbt-vaadin-plugin

Vaadin plugin for Simple Build Tool
Scala
7
star
18

misc-hardware

Miscellaneous/utility/convenience hardware by Gekkio
5
star
19

gb-cart8m-a

GB-CART8M-A flash cart firmware
Python
5
star
20

moca-hcho

Bluetooth 5 BLE formaldehyde/temperature/humidity sensor beacon
Rust
5
star
21

sbt-eclipse-plugin

SBT Eclipse Classpath Container
Java
5
star
22

vaadin-skeleton

Sample project for SBT/Scala that uses Vaadin
Scala
5
star
23

zk-async-example

Example of asynchronous processing and server push with ZK
Java
4
star
24

blog

All sample code that is used in my blog
Java
4
star
25

mcp2210-rs

Microchip MCP2210 library using hiddraw (Linux-only)
Rust
4
star
26

snooze-rs

Experimental library for sleeping periodically in Rust code
Rust
4
star
27

libyuv

Unofficial mirror of libyuv
C++
3
star
28

naughtyemu

naughtyemu.gb: silly Game Boy internal bus conflict test ROM
Assembly
3
star
29

gb-live32

Firmware and utilities for the GB-LIVE32 rapid development cartridge
C
3
star
30

jawscala

Jawsy Solutions libraries for Scala 2.9+
Scala
2
star
31

splake

Collection of extensions and library code for the ZK framework
JavaScript
2
star
32

gekkio.fi-hakyll

Hakyll source code for gekkio.fi (legacy)
HTML
2
star
33

jawwa

Jawsy Solutions libraries for Java 1.6+
JavaScript
2
star
34

retro-dat

Parsing library for Logiqx DAT files
Rust
2
star
35

nelma

Simple boilerplate for serial communications with proper packet framing
C
2
star
36

sbt-metadata-exporter

Processor for Simple Build Tool that exports project metadata in XML format
Scala
2
star
37

gb-chr

Game Boy: Complete Hardware Reference
TeX
2
star
38

red-sculpin

Experimental Rust crate intended for implementing controller-side IEEE 488.2 / SCPI 1999.0 protocols
Rust
2
star
39

bamboo-sbt

Adds SBT support to Bamboo
Java
1
star
40

maghug

A battery-powered device that blinks a LED if it doesn't get hugs from a magnet
Eagle
1
star
41

gekkio-eagle-libs

Eagle CAD libraries by gekkio
1
star
42

picdux-41630

Arduino/Teensy-based PIC low-voltage ICSP programmer for devices listed in Microchip datasheet 41630
Arduino
1
star