A game boy emulator, written in rust!
Inspired by Ferris Makes Emulators
Right now, the only build requirement is rust
To run, the emulator expects a dmg_rom.bin with sha1 sum of 4ed31ec6b0b175bb109c0eb5fd3d193da823339f
, and the included roms/test.gb
DEBUG=true cargo run --release
If you would like to try other roms, try
DEBUG=true cargo run --release -- roms/my_cool_rom.gb
- to Dissecting the Game Boy for an accessible visual overview
- Past Raiser's opcode chart for a succinct chart of all opcodes
- the gbdev wiki for bootstrap rom and other reference material
- mmuszkow's game boy disassembler for letting me understand and debug all the roms
- ASMschool for dev-oriented writing
- #rust-beginners for being friendly
- 8080, z80, gameboy~z80, and 6502 opcode comparison gameboy~z80 is funky
I am trying to verbosely write about the creation process. Please see the development log for a narrative, and notes for more of a scratchpad.
Some of the more interesting commits, due to documentation and understanding of the game boy, emulators, or rust:
- reading and printing a header from a rom
- implementing checksum for the game boy rom
- first multiline commit message
- what its like to stare at numbers for a long time
- how to model a virtual processor
- blindly copying ferris
- starting to understand differences between arrays, slices and vectors
- *memory mapping / difficulties implementing a trait in rust
- *the first version of the emulator that runs an emulated instruction!
To install dependencies
cargo install
Put some roms in roms/
, then test their checksums with
cargo test
It should only show 1 passing test - if you want to see that it is testing your roms, try
cargo test -- --nocapture
To run a game
cargo run -- DMG_ROM.bin roms/Tetris\ \(World\).gb
Note, this requires the game boy boot rom, which I cannot distribute. You can google for it though.