My First Emulator
Venturing into Hardware Emulation
A few days ago I finally fulfilled one of my long pending projects, creating an emulator.
It is a basic Chip-8 emulator, considered by many the best project to start in this field.
Chip-8 is a very small and simple specification, it consists of 36 8-bit instructions with a recommended clock speed of 500hz. Certainly not even close to run the linux kernel, but powerful enough to run Space Invaders. Being a simple project didn’t make it any easier, the documentation found online is not always correct, and some of the function implementations require you to be fluent in Hex, binary and logical operations, which I’m used to use, but not at this level of complexity. In the past, I tried starting with the 6502 CPU, the one used in the NES, but I was overwhelmed by it and eventually abandoned it.
Anyway, Chip-8 thought me way more than I thought it would, giving me the tools to finally continue my 6502 and possibly more complex ones like the Z80 or the Intel 8080.
A little piece of advice
After finally finishing the project in about 4 days, I wanted to remark a few things that I would’ve liked someone put out there to lead me in some of the issues I ran into, for that, I’ve created this file, it contains common mistakes that I’ve made and seen in another people’s projects. I hope you find it useful if your own emulator is acting weird, don’t forget to comment about it in the bottom of the page.
You can find the full source code here, including a binary release.
Thanks for reading, happy coding!