So I decided without falling back on buying a new Gameboy, I’ll make one.
Having written an operating system in assembly before, and my playing around with microcontrollers, the concept is simple.
All I required was some informations on the clock timings, and when the vertical sync happens.
There is plenty of documentation on the GB, my favourite of which is the Gameboy CPU Manual since it had a breakdown of the opcodes and registers as well as memory addresses.
After setting up a large switch statement to handle the opcodes, I began by running Pokemon Red, which gave me the initial NINTENDO logo before getting stuck in a loop. After a bit of debugging, it turned out one of my opcodes was functioning wrong (I should have wrote a unit test for all of them).
Using GLUT I was able to read the part of memory where the LCD output gets drawn to and render it.
After some tweaking around with sprites, I finally got the Pokemon to show on the title image. I have yet to setup input so I cannot progress beyond this screen.
I’m starting to wonder if I can make an attachment to my iPhone for the cartridge to plug into so I can play it and other games.