Gameboy displays two kinds of graphics: background (which is usually more static) and sprites (moving objects, like Mario or falling block in Tetris). The next step was implementing the basic graphics support. That was exactly the thing I was looking for - after just 3 days I had an application running the Gameboy code!įor (Entry t : indexedList(0x0b, 0x10, "BC", "DE", "HL", "SP")) ").load(t.getValue()).alu("DEC").store(t.getValue()) However, when the original Gameboy starts, it executes a simple 256-bytes program, a kind of firmware displaying the Nintendo logo and self-testing the system. I had neither the cartridge nor the GPU emulation yet, so even the simplest game wouldn’t be an option.
#Gameboy emulator code
After implementing the opcodes and memory (modelled by an int array) I was eager to check whether it’s possible to run some code on it.
#Gameboy emulator manual
As a reference, I’ve used the GameBoy CPU Manual - later on I discovered that it has a few typos and is not specific enough for some of the operations. It’s not exactly the Z80, but it’s pretty close. CPU and memoryįirst I implemented all the Gameboy CPU opcodes.