Why Build a Gameboy Emulator


I think everyone should build an emulator and some point or another.

I was recently playing some Pokemon Red on the original Gameboy. Something about the game captivates me. A large portion of this appeal comes from the emulator. I find it fascinating how we can now run an emulator on almost any platform. I decided I wanted to build and emulator so that I could have a full understanding of the Gameboy. I always wanted to know how a computer works, and so I thought if I confined myself to only using the basic building blocks of code I could learn for myself how computers work. This is exactly what I’ve been doing for the past few weeks. I decided to build the emulator in javascript so that I could put it on this website as a demo. I’m still not finished, but couldn’t wait to write this blog post.

Difficulty

I would recommend learning a language at least to an intermediate level before starting on an emulator. It will require a decent understanding of any language as a foundation. With the right resources, it’s not impossible. The main resource is the Pandoc: https://gbdev.io/pandocs/. This website details everything you need to know in order to emulate the basic function of the Gameboy. Another website you will no doubt need is the CPU instruction map: https://meganesulli.com/generate-gb-opcodes/. I like this website because it actually explains very well each instruction.

Why Write An Emulator?

If you have always wanted to learn concretely, without any shadow of a doubt how a computer works, this is the way to go. It will teach you the basics of how a CPU reads and executes instructions, the basics of memory, graphics, audio, etc. It’s incredibly rewarding as well. When I’m finished, I will write a another post with more detail. You can follow my progress here: https://github.com/Green-Robot-Dev-Studios/GameboyEmulator (this repository has been updating since posting this blog). If writing an emulator is not for you, you should still check out this great talk for 33c3 https://www.youtube.com/watch?v=HyzD8pNlpwI.