yet another gameboy emulator
- Written in rust (as a way for me to learn the language!)
- Emulation of all SM83 processor instructions
- passes the blargg
cpu_instrs
test roms - passes the jsmoo instruction tests. These were very helpful for validating basic CPU function! (Place these json files in the
moo-tests
directory and run with atest-moo
argument) - not cycle accurate -- the base unit of time is one instruction, which ranges from 4 - 24 "T-cycles", aka 1 - 6 "M-cycles"
- passes the blargg
- A basic text-based gdb-like debugger for monitoring processor status
- Line-based PPU (pixel-processing unit) rendering
- 4 of 5 interrupts are generated and handled (LCD Vblank, LCD status change, timer overflow, and joypad button press), but again not at a cycle-accurate level
- MBC1 cartridge support
- Joypad is hooked up to keyboard:
WASD
for direction,jk
for B/A, and,.
for select/start - LCD screen is displayed on the monitor using the SDL2 library
- Audio is not yet implemented (but I want to at some point!) Right now it just plays the same jingle over and over again.
- Serial port output gets printed as ASCII to stderr
Many thanks to the many enthusiasts who have shared information online. In the process of working on this, I totally blown away by the dedication and kindess of this online community. There is so much stuff available! I made extensive use of the resources I could find, and in a few places my implementation derives from what I saw (though I tried my best not to peek too much!)
I am grateful to the following websites in particular:
- Bugzmanov for this great tutorial on writing an NES emulator in Rust; the Rust-specific aspects of emulator programming I owe to you!
- izik1 for this nifty opcode table!
- Nintendo devs (?) for the official GameBoy programming manual (pdf!) with all the opcode and register specifications.
- Gekkio's for the complete Technical reference (pdf!)
- all the contributers of the pandocs
- Randy Mongenel for this nice memory map and general information
The code is not perfect, but I am not a professional programmer :) It works well enough to run simple games (like Kirby's dreamland and Link to the Past!) and that is enough to make me happy for now. Some other games don't really work. If you want to try to run it yourself, I have no idea if it will compile on your computer since I have only compiled it on my computer so far (x86 Linux).