3 ms·
I also wrote a gameboy emulator a few years ago... But I disagree about it being fun. The truth is it's rather tedious. There are 256 opcodes you will need to
by Gunax 6y ago
I also wrote a gameboy emulator a few years ago... But I disagree about it being fun.
The truth is it's rather tedious. There are 256 opcodes you will need to create. Each has certain flags you will need to check that change it's operation.
Some of those flags are undocumented, and several of the opcodes actually have hardware level bugs that make them act differently than the CPU document describes.
So after creating every opcode, you will inevitably have bugs which you need to fix.
After fixing those you will still not have games running because of so many undocumented/buggy opcodes, so now you need to figure out how an actual gameboy operated.
At this point I was only able to solve it be getting a working emulator and executing the same program on each until their states diverged.
I did find it interesting to learn about low level hardware, but I'd say the project is 50% reading specs, 10% interesting, and 40% tedious pain-in-the-butt.
I never did get sound working, and the graphics are buggy, but I think I got far enough that I learned all there was to learn.
- cardiffspaceman 6y agoI targetted getting the boot rom to animate and make sound over a short time, and it ended up taking a bit longer. But when I got the boot rom to run, I did stop. I didn't know about the fact that the halt opcode caused clicks in the audio. I used ALSA for the sound and the hard part was understanding what the memory register flags meant.
- ChickeNES 6y ago> Some of those flags are undocumented, and several of the opcodes actually have hardware level bugs that make them act differently than the CPU document describes. They don't, whatever documentation you used was either wrong or based on the Intel 8080 or Z80 instead of the Sharp SM83 core that's actually used in the original Gaemboy.
- Gunax 6y agoYes it was wrong! I used the 'gameboy programming manual' which was sort of the magnum opus of gameboy documentation at the time that was available to the fan community. I am googling it now, and there are some forum posters saying ' don't use that, it's old and not completely accurate' but it was all that I could find at the time. I'm aware that it's not official documentation, but you have to remember this was over 10 years ago--there might be better resources now.