A Game Boy emulator written in C++ to develop a better understanding of how certain machines work together in a precisely synchronized fashion in order to keep a gaming addict like myself addicted.
It's not the most accurate emulator out there, but it's accurate enough to play some of the games I grew up with, such as my beloved Pokémon Yellow.
Tested on MacOS so far.
cmake
, SDL2
, SDL2_ttf
, tinyfiledialogs
(included in repo)
TODO: My CMakeLists.txt is not the most sophisticated in finding SDL2. I'll work on that. For now, we have to manually set the paths to SDL2_ttf.
cmake .
./stoicgb Opens a file dialog for selecting a standard Game Boy ROM
- Accurate CPU with correct opcode implementations and timings. It is the CPU, at least in my implementation, that is central to synchronizing all components.
- PPU (whose timings are accurate enough to render many games).
- Working stereo audio using
SDL_QueueAudio
(again, timings are accurate enough for many games). - Memory Bank Controllers: MBC0 (no MBC), MBC1, MBC2, MBC3, MBC5 (no RTC support) .
- Battery for saving (via external RAM dumps).
- Loading of save files (automatically attempts to load from the same directory as a battery-supported ROM).
- Disassembler (for debugging).
I still have a lot of work to do in terms of accuracy, and I also plan on adding more features, but I'm happy with the progress I've made so far.
Key | Action |
---|---|
Enter | Start |
Space | Select |
↑ | Up |
↓ | Down |
← | Left |
→ | Right |
Z | A |
X | B |
esc | Quit |
|
TODO: List all the tests. Many pass. Alas, much fail. |
Pokémon Yellow | Pokémon Yellow (yes, again) |
Donkey Kong Land | Super Mario Land |
The Legend of Zelda: Link's Awakening | Metroid II: Return of Samus |
Tetris | Dr. Mario |
I'm grateful to those who have made Game Boy documentations available to the public. I've learned a lot from them, and I could not have made this emulator without them. Here is a non-exhaustive list roughly categorized by topic of some of the resources I used:
- izik1's gbops, an accurate opcode table for the Game Boy
- gekkio's Game Boy: Complete Technical Reference
- Sharp Microcomputer Databook (p. 140)
- hacktix's GBEDG: The Gameboy Emulator Development Guide
- Low Level Devel's Gameboy Emulator Development Tutorial Series
- NightShade's Game Boy Sound Emulation
- gbdev's Gameboy sound hardware
- A Reddit comment by the creator of GhostBoy
and, of course, Pan Docs.