Skip to content

smparsons/retroboy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Retro Boy is a simple Game Boy emulator written in Rust that can be played on the web. Try it here.

How to Compile to WebAssembly

To compile the implementation to WebAssembly, you will first need to install wasm-pack with the command cargo install wasm-pack if you haven't done so already. Then, run sh ./build-wasm.sh to build the core project and generate the Javascript binding code in the web frontend directory.

Web Frontend

The web frontend for this emulator is a React/TypeScript app designed with Material UI. It is located in the frontends/web folder. The UI provides the ability to load a ROM as well as play, pause, or reset the emulator. It also provides a fullscreen mode.

To run the web frontend:

  1. Compile the Rust code to WebAssembly and generate the Javascript binding code as described in the "How to Compile to WebAssembly" section.
  2. When the binding code is generated, it will be added to the frontends/web/src/core directory.
  3. Run yarn install in the frontends/web directory to install all dependencies.
  4. Run yarn start in the same directory to run the application locally.

Screenshots

Test ROMs

This emulator passes the following test suites from Blargg's test ROM collection:

  1. CPU instruction tests
  2. CPU instruction timing tests
  3. Memory timing tests
  4. Memory timing tests 2
  5. APU tests (DMG)

Additionally, this emulator passes all JSON CPU tests, and only some tests from the Mooneye test ROM collection.

Test Suite

This project holds a fairly extensive test suite, as the bulk of the logic was designed using a TDD approach. There are a lot of tests that exercise CPU opcodes, and basic tests that exercise the GPU. Run cargo test to run the test suite.

Supported Features

This emulator is still a work in progress and not all features are supported.

Feature Supported
CPU
Basic Graphics
Audio
Color Support
GameShark Support

MBC Support

Type Supported
MBC1
MBC2
MBC3
MBC5
MBC6
MBC7

(For MBC3, no RTC support yet.)

Helpful Resources

I described some of the resources I used to build this emulator in a blog post.

For convenience, here is a list of the resources I used:

  1. Gameboy CPU Manual
  2. Pan Docs
  3. Blargg's Test ROM Collection
  4. Gameboy Doctor
  5. Imran Nazar's Gameboy Emulator Tutorial

Future Plans

The following games work pretty well with this emulator:

  1. Tic-Tac-Toe
  2. Tetris
  3. Kirby's Dream Land
  4. Pac-Man
  5. Super Mario Land

Pokemon Red works for the most part but has a couple minor glitches (from what I've seen so far). Pokemon Silver works from what I can tell, however the clock does not work properly due to there being no RTC support.

About

A Game Boy emulator written in Rust.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages