Skip to content

Lumbi/gabboy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

96 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gabboy

A very basic Game Boy emulator for MacOS. Currently it can only run a specific version of the bootrom (DMG) and display LCD data (no sound).

For educational purposes only! Not for commercial use. (Not that it could ever be).

image

Why

I'm mostly experienced with high-level programming but I've always been interested in low-level stuff. However, it can be very daunting to start learning and documentation can be pretty obscure at times.

A few years ago, I tried out the From Nand to Tetris course which really helped me understand how computers fundamentally work. I highly recommend it.

Fast-forward to now, while getting my hands dirty with C++ and optimization, my interest for low-level programming sparked again. With a bit of confidence and determination, I decided to take up the challenge and see how far I could go in implementing a Game Boy emulator.

How

This is roughly how I went about it:

  1. Read as much reference material as possible
  2. Implement the instructions found in the bootrom one by one
  3. Implement background tile map to LCD data mapping
  4. Implement bridging to Swift and render

Learnings

Implementing the instruction set was tedious but not too difficult in the end. Having tests helped immensely, especially when refactoring code.

I found that blindly implementing the instruction set is not enough. To fix bugs, I really had to understand what the bootrom was trying to do and how instructions played together. Understanding how the VRAM works and how the Gameboy handles graphic data was also crucial.

I'm very fortunate that there are so many good reference material out there nowadays. But there were sometimes discrepancies between documents so relying on the actual code itself was best.

References:

Special thanks to gekkio for the useful technical reference manual with machine cycle timings.

Note: Game BoyTM, Game Boy PocketTM, Super Game BoyTM and Game Boy ColorTM are registered trademarks of Nintendo CO., LTD. © 1989 to 1999 by Nintendo CO., LTD

About

A Game Boy emulator for learning purposes

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published