Side-Project in <500 Words Oxiboy - A Gameboy emulator in Rust

Daniel RibeiroDaniel Ribeiro
2 min read

Oxiboy - A Gameboy emulator in Rust

#side-project-in-500-words #gameboy #emulators #side-project

Introduction

Oxiboy is my first Rust pet-project, and honestly a very ambitious one. The project was an attempt to learn Rust while also learning how hardware emulation works in general - which eventually led me to want to write an emulator for my all-time favorite game console: the Game Boy (my favorite was actually the Game Boy Color, but the emulation is rather more complicated and so I went with the least difficult option).

My goal was to design a set of abstractions and eventually a top-level system that emulates the GameBoy hardware in both an expressive and a coherent way, such that I could understand how components should communicate and why some things work they way they do. A few examples of such abstractions are:

  • a CPU module defining the CPU, its instructions, ops and registers.
  • a PPU module defining the PPU (pixel-processing unit, or graphics-card) and its registers.
  • at a higher-level, the system was sub-divided into three modules:
    • gameboy - The Game Boy hardware model.
    • debugger - A debugger system to enable stepping into CPU operations in a very rudimentary way.
    • emulation - An emulation module that runs the hardware in a given context like, a cycle-accurate execution mode.

I ended up reaching the point of emulating most instructions and eventually got to work on the pixel-processing unit and the graphics memory mapping, and by the time I got to trying to emulate the turning of the LCD screen, that's when things got more complicated, and also where my motivation started to plummet down, as usual with these bursts of energy that I have from time to time.

In any case, it's still a project that I continue to look at these days mostly for reference and also try to keep it up-to-date with the latest Rust versions and idiomatic approaches. That being said though, I will probably not work on anything substantial on this project in the future. Who knows.

Dependencies

Resources:

4
Subscribe to my newsletter

Read articles from Daniel Ribeiro directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Daniel Ribeiro
Daniel Ribeiro