I’ve been messing about with emulators! The GB hardware is very well documented with lots of interesting blog posts on the topic so I’ve decided to have a go at writing a gameboy hardware emulator myself.
The current status of the project is that I’ve implemented most of the CPU opcodes, GPU emulation and memory bank controller emulation required to get tetris up and running. I also wrote a GPU debugger, memory inspector and disassembler using imgui that can be used to find emulator bugs. I’m also using my own GLWT library to create a window and make an OpenGL context.
So there is just about enough there for you to get through the menus, watch the demo mode and play a game of tetris! There are some crazy bugs though - I’ve not implemented the hardware used for random number generation so you only get square blocks falling from the top of the screen making for a less than entertaining game of tetris. In addition the sprite rendering has an off by one error somewhere (a faulty instruction somewhere?) meaning the blocks are shifted down by 1. Audio is also not implemented yet.
I’m currently focused on writing some cpu unit tests for the whole thing to find and fix those faulty instructions, but it is a huge task and is taking me a while. Overall it’s been a pretty fun project to hack around with so far.
I’ve thrown the whole source code of the thing up on github - take a look! https://github.com/zanders3/gb