I’ve been following game console emulation for a long time and I decided I wanted to learn more. Specifically, the hardware aspect because I have no experience with how chips work.
In order to learn more, I decided to write an emulator for a simple system. I originally thought NES but that is more complex than was realistic for me. Next, I thought of the Atari 2600 but even that seemed like a bit more than I’m ready for. I ended up choosing Chip-8 because it is touted as the “hello world” of emulator projects.
Chip-8 is perfect for learning because it’s a single microprocessor with a very limited instruction set. It’s very simple and there is a lot of information about it.
That said, I do realize that Chip-8 is technically an interpreter but that’s semantics I really don’t feel like going into.
It turns out there has been multiple Chip-8 versions over the years. Each with slightly different behavior. Some of this is due to bugs introduced, platform difference, and people trying to extend or modernize the system.
At first I planned to support the original Chip-8. But quickly learned this version isn’t widely used anymore. Most people write to the specification from Wikipedia which is sub set of Super Chip. It documents the updated instructions from the original but doesn’t include the new instructions added by Super Chip.
I quickly pivoted to the Wikipedia version but I wasn’t really happy. It seemed limiting and wrong to only support a subset of features. This lead me down a rabbit hole of wanting to support every major Chip-8 version. Including one of the most modern, and most complex, XO-Chip (Octo).
My Emulator: Chipped-8
With that said, meet Chipped-8! My Chip-8 emulator.
I wrote the emulator in Python because I like working with Python.
What started as an emulator core with a basic view port is quickly turning into something larger. I want to take this further than a simple learning project and I plan to turn this into a full fledge stand alone emulator.
Currently Supported Features
The following platforms should be supported properly. I believe I have all of the extensions and the quirks implemented properly. It passes all tests in the chip8-test-suite. However, this test set focuses on original, Super Chip, and XO-Chip.
The core and GUI are split into separate modules. The core being a module allows other other emulators to easily incorporate and support chip-8.
Currently, there is a basic GUI using Qt. It’s quite limited and is mainly a view port for whatever is running. You can load a ROM from the GUI but you really need to use the command line when starting Chipped-8. You can only set the platform to run as on the command line but this is going to change in the future.
Full featured GUI
I want to add a library system. Basically, a table with a list of all ROMs. It will display metadata about the ROM and allow edit the info. Along with setting the platform so it will always run properly.
I plan to use the chip-8-database. That way I can auto fill metadata. This also allows automaticlly selecting the best platform so it doesn’t need to be specified manually.
Maybe Future Features
Further core and GUI splitting
While the core and GUI are split by design, they are in the same project so you can’t install the core module standalone. If you install Chipped-8 you get the GUI. I think it’s appropriate to split them into separate projects. However, if the chipped-8 GUI is going to be the only consumer of the core, it easier to leave them together.
I’d also like to make the core into a libretro core. Most people emulating these days use emulator front ends like OpenEMU or RetroArch. Being a libretro core would make this project more widely accessible.
Making a libretro core would necessitate fully splitting the core and GUI into separate projects. With the libretro core being it’s own project.
libretro has a very easy to use API for building cores. However, it’s a C interface. While that’s perfect if the core is written in C or C++, Chipped-8 is written in Python. Which isn’t trivial to be called by a C library. I’m not sure I want to go to this level of effort. Especially for an emulator core that very few people, if any, would actually use.
Better sounding audio
XO-Chip audio is currently accurate but isn’t very clear. I’d like to make the audio sound better. Currently it’s limited by my lack of knowledge in regard to audio wave form processing.
I used a lot of resources while building this application and I’d like to list the ones I found the most helpful.