Starting a Gameboy Emulator
A week or so ago I ran across a video called The Ultimate Gameboy Talk, and indeed it was. Inspired by the simplicity and elegance of the original Gameboy, I decided to try my hand at building an emulator. A week later I have this:
I'm fully aware that my obsession with this project is a manifestation of my own mental instability. You see in my day job I work on software, but nothing is in my control. I can't control the deadlines. I can't control my staff. I have to go with what happens and constantly fight fires. It's okay, that's why I'm paid to do my job, but it is no way relaxing.
Building a gameboy emulator is the exact opposite. The problem is constrained. The hardware is fully documented, there are no more games being made. The specs won't change half way through. It's sort of like a jigsaw puzzle. I *know* that every piece has a final resting place. That's why I find it simulatenously stimulating and relaxing.
For this project I'm using Rust. There already exist several Rust Gameboy emulators, but that's not the point. This will force me to learn how to use Rust better. To learn how low level bit twiddling coding is done. Programming languages are tools. The more time you invest in the tool the better you can use it. Since I think Rust is one of the most important languages of the last 20 years, I want to invest a lot.
Over the next few weeks I'll keep adding more until I can at least play Tetris. I'm a long way from that point. I can barely execute a simple test rom, as you can see above. Even that little bit was an achievement. I had to build over 200 Z80 opcodes and learn about memory access and bank switching just to get to this point. I think I have a pretty good handle on it now, though, and IntelliJ's Rust refactoring tools are far better than I expected. Hopefully visual progress will accelerate soon.