But first, let’s talk a little about some statistics. The final version in that tweet is actually 68 lines of code (I tweeted the wrong number!), each line less than 150 characters long, for a total of 9956 bytes. If you ignore whitespace and comments, it comes to 4720 bytes. That’s too large for the International Obfuscated C Code Contest, but pretty close.
This is quite an in-depth post on making an absurdly-compact new GB emulator. Making one is actually a lot of fun and I recommend the coders out there give it a try. 🙂
From 2017, this coder covers why (and how) he created a new GB emulator using Java called
. Coffee GB
So why did I spend all this time trying to write it? I treated it as a programming riddle (or a series of riddles), quite similar to those you can find on the
Project Euler. It’s a complex, self-contained problem that can be nicely splitted into stages (as I did in the blogpost) and every stage, once completed correctly, gives a rewarding result. Maybe because of these results I got quite addicted to the project itself. Tomek Rękawek
You can find
the source code on GitHub. Important resources mentioned are The Ultimate Game Boy Talk and the Unofficial Game Boy CPU Manual, which may get their own posts in the future. 😊