Code Monkey home page Code Monkey logo

gabboy's Introduction

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

gabboy's People

Contributors

lumbi avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.