RGB (Rust Game Boy) is a simple emulator for the original game boy

Related tags

Emulators RGB
Overview

RGB

Build Status

RGB (Rust Game Boy) is a simple emulator for the original game boy and the color game boy.

Warning: This no longer compiles in the latest versions of rust; use version 1.20.0 instead. At the moment, fixing things for newer versions is not high on my priorites list

ScreenshotScreenshot ScreenshotScreenshot Screenshot

How to Build

Install Rust and run the following commands in a terminal

git clone https://github.com/NivenT/RGB
cd RGB
cargo build --release

In order for it to build, you must have SDL2 installed. On Ubuntu, run

sudo apt-get install libsdl2-dev

If that doesn't work, try running

sudo add-apt-repository ppa:zoogie/sdl2-snapshots
sudo apt-get update
sudo apt-get install libsdl2-dev

How to Use

Before running the program, make sure to setup the settings.ini file. This is where you supply a path to the game to be loaded, tell the emulator which keyboard keys map to which gameboy buttons, and specify what hex colors the emulator should use for graphics. You can also supply a path to a binary file containg the gameboy BIOS. Even if you do not have a copy of the gameboy's BIOS (you supply a path to a nonexistent file), the emulator will still run. If you supply a CGB BIOS file, the emulator will run as a gameboy color, but if you supply a monochrome gameboy BIOS file, the emulator will run as a monochrome gameboy. If no BIOS file is supplied, it will decide which to run as depending on if the loaded game was made for monochrome of color gameboys. RGB uses SDL2 for window management and input handling, so check here for the values of each key.

Once settings.ini has been set up, start the program by running the following command from the project's main directory

cargo run --release

Once the program starts, it behaves like a gameboy with the keys you specified as the buttons.

Special Inputs

Certain keys are special, and the emulator has built in responses for when they are pressed.

  • P - Toggles whether or not emulation is paused
  • D - Toggles whether or not the emulator displays debug information
    • R - Toggles whether or not register values should be included in the debug information
    • Up/Down - When paused, scrolls through the displayed debug information
  • F - Emulates a single CPU instruction if paused
  • M - Prompts for a starting and ending memory address. Emulator then prints the values stored in memory between those addresses (inclusive on starting and exclusive on ending)
  • Esc - Exits program
  • 1..0 - Runs the emulator at normal (double, triple, ..., up to 10x) speed

Since this list has been growing, and since I often accidentially press these when testing, you can disable these special keys. In the settings.ini file, there are two flags named enable_development_keys and only_gameboy_buttons. If the first one is false, then the only special inputs will be P, Esc, and the numbers. If the second one is true, then the only special input will be Esc.

Debugging

For helping with development, I've built some debugging features into the emulator.

  • The main one is what happens when you press D. The emulator displays the opcodes it's executing (along with their inputs) in real time, and you can scroll through this output via up/down arrows if emulation is paused.

Screenshot

  • Another source of debugging information is the disassembly.txt file. Whenever a game is first loaded, the emulator (attempts to) disassemble its source code and print the results into this file for later viewing.

  • settings.ini contains a bios_breakpoint flag. When this is set to true, the emulator will automaticallyy pause once the BIOS has finished running. This makes it easier to step through a game from the moment it begins. There are also infinite_loop_breakpoint and unimplemented_instruction_breakpoint flags in case the emulator enters a (detectable) infinite loop or encounters a nonexistent instruction.

Known Bugs/Issues

  • Gameboy Color games may have slight graphical bugs
  • There is no sound
  • The emulator seems to have issues with certain CGB Games
    • Originally thought this was related to cartridge type, but that seems to not probably be the issue after all
  • When you press D to enter debug mode, it's common for the gameboy screen to stop being displayed; it usually comes back if you just pause and wait a while though.

If you find any other problems (including any way it fails on specific games), please open an issue.

You might also like...
A Flash Player emulator written in Rust
A Flash Player emulator written in Rust

website | demo | nightly builds | wiki Ruffle Ruffle is an Adobe Flash Player emulator written in the Rust programming language. Ruffle targets both t

A Gameboy Emulator in Rust

RBoy A Gameboy Color Emulator written in Rust Implemented CPU All instructions correct All timings correct Double speed mode GPU Normal mode Color mod

Full featured Cross-platform GameBoy emulator by Rust. Forever boys!.
Full featured Cross-platform GameBoy emulator by Rust. Forever boys!.

Gameboy Full featured Cross-platform GameBoy emulator. Forever boys!. You can start a game with the following command, here with a built-in game "Boxe

An NES emulator written in Rust

Pinky Pinky is an NES emulator written in Rust completely from scratch based only on publicly available documentation. You can run it in your Web brow

NES emulator written in Rust

sprocketnes is an emulator for the Nintendo Entertainment System written in the Rust programming language. Its purpose is to serve as a technology dem

NES emulator in rust
NES emulator in rust

NES emulator in Rust plastic is a NES emulator built from scratch using Rust. This is a personal project for fun and to experience emulating hardware

ZX Spectrum emulator written in Rust
ZX Spectrum emulator written in Rust

rustzx ZX Spectrum emulator which I writing in rust. I develop this project just for fun and for learning the basics of computer architecture. License

Intel 8080 cpu emulator by Rust
Intel 8080 cpu emulator by Rust

i8080 i8080 is a emulator for Intel 8080 cpu. 8080 Programmers Manual 8080 opcodes [dependencies] i8080 = { git = "https://github.com/mohanson/i8080"

CHIP-8 emulator written in Rust
CHIP-8 emulator written in Rust

CHIP-8 emulator written in Rust. This is intended to be a project for gaining experience writing emulators and practice Rust.

Comments
  • Dr. Mario freezes after pressing enter on the title screen

    Dr. Mario freezes after pressing enter on the title screen

    I'm working on my own emulator, and I remember seeing this issue in your README while I was looking at rust GB emus. I have just gotten to the point where I am trying to get Dr. Mario running, and it froze before starting a game too. Check out this post about someone else who had the same problem.

    I tried changing the STAT register to be set to mode 0 (HBlank) when the LCD is turned off, and Dr. Mario runs perfectly for me now. You may want to look into this, because I notice that you set the STAT register to mode 1 when the LCD is off, this may be where your problem lies.

    opened by mattbruv 2
  • Tetris pieces don't display while falling

    Tetris pieces don't display while falling

    I downloaded and ran tetris and when I got to main gameplay, the pieces weren't displayed until they landed. I guess this falls under the known issue of sprite displaying. Thought it might be helpful to have a specific known example.

    tetris

    opened by qpwo 1
Owner
Niven Achenjang
Niven Achenjang
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. The main goals of this project are accuracy and documentation. Some

Joonas Javanainen 802 Dec 28, 2022
RustBoyAdvance-NG is a Nintendo™ Game Boy Advance emulator and debugger, written in the rust programming language.

RustBoyAdvance-NG Nintendo GameBoy Advance ™ emulator and debugger, written in rust. WebAssembly Demo: https://michelhe.github.io/rustboyadvance-ng/ P

MishMish 510 Dec 30, 2022
A cross-platform sequencer that internally uses a Game Boy emulator to synthesize the sound

chiptrack chiptrack is a cross-platform sequencer that internally uses a Game Boy emulator to synthesize the sound. It uses: SixtyFPS for the UI. RBoy

Jocelyn Turcotte 26 Dec 7, 2022
A CPU emulator for running unit tests on Game Boy code.

evunit This is a unit testing application for Game Boy roms. It includes a CPU emulator, and loads test configurations from TOML files. Configuring a

Evie M. 8 Jan 1, 2023
Nes-emulator - A NES emulator made to learn the Rust programming language

nes-emulator Building $ rustc --version rustc 1.32.0 (9fda7c223 2019-01-16) $ cargo --version cargo 1.32.0 (8610973aa 2019-01-02) $ cargo build --rel

Michael Burge 225 Dec 23, 2022
A simple CHIP-8 emulator written in Rust.

CHIP-8 emulator This is a small learning project to get familiar with emulator development, the Rust programming language and the SDL2 library. Discla

null 3 Aug 31, 2022
A simple NES emulator implemented in Rust. (WIP)

remu A ?? ?? BLAZINGLY FAST* ?? ?? NES emulator implemented in Rust. Status: Work in progress. About This emulator is mainly meant to be more of a lea

luna 10 Aug 25, 2022
NES emulator written in Rust to learn Rust

OxideNES A NES emulator in Rust. CPU should be accurate, PPU is mostly accurate, timing between the 2 is off for some corner cases and hardware qui

null 37 Nov 7, 2022
Chip8 emulator written in pure rust, using rust-sdl2 for graphics

Rust-8 chip8 emulator written in rust, using rust-sdl2 for graphics. Features Fully implemented all 35 original chip8 opcodes. This emulator does NOT

Chris Hinson 7 Dec 28, 2022
Commodore 64 emulator written in Rust

Rust64 - a C64 emulator written in Rust This is my attempt to study the Rust programming language and have fun at the same time. The goal is to presen

Krzysztof Kondrak 214 Dec 27, 2022