r/programming • • Jul 10 '22

I finally wrote my first ever emulator (GameBoy)

https://github.com/Mika412/NoobBoy
1.1k Upvotes

77 comments sorted by

View all comments

96

u/SioBane Jul 10 '22

This is something I’ve been wanting to do for a long time. How did you get started and what resources did you use when starting out? I’d love to hear more about the process of this type of project. Seriously though, awesome job.

190

u/Mika412 Jul 10 '22

Thank you! I first watched the "The Ultimate Game Boy Talk". It has an overview of all the important components. It was after this talk that I decided to write the emulator. I strongly recommend the talk.

During the development, these were the main resources I used:

I also had to do a lot off googling when I didn't know what was happening. Especially in the beginning when I got stuck on the Tetris copyright screen.

There were multiple times where I got stuck with the CPU timings and the PPU. So I modified the Gearboy to print some extra info, like registers and timers, so I could compare with mine and figure out where it failed.

12

u/FrancisStokes Jul 11 '22

Something I learned when writing a GB emulator was that while the "Ultimate" talk is amazing, it has some serious errors in relation to the PPU pixel fifos that caused me a lot of headaches. This site ended up being invaluable to getting an accurate PPU implementation.

4

u/Mika412 Jul 11 '22

It works well as an overview. But yeah, I agree, you shouldn't go only by that. The PPU is a pain, if it wasn't for the wiki and the Gearboy, I probably wouldn't have gotten it to work. Unfortunately, because I had to modify the source of the Gearboy, I had to look at some of the code, which may have influenced some of my decision.

I still have a lot of mistakes in the PPU, so I'll definitely use the link you shared. Thank you!

6

u/foursticks Jul 10 '22

So cool. Congrats!