1 minute read

I have implemented a CHIP-8 VM, based on starrhorne’s amazing CHIP-8 emulator. I wanted to play with Rust’s low-level stuff and work on a small emulator, and this was a great choice. Since it is pretty much based on starrhorne’s project, I forked it. Some parts of it are the same source files, self-commented, with a few tweaks here and there which don’t really change the overall behavior.

Example of the CHIP8 emulator running Blitz

I added a few functions such as being able to see the CPU registers, stack contents and a small instruction history, which requires providing a valid .ttf file for displaying text. I included one (Terminus TTF) in the project.

I also moved around some structural parts, such as the timers which now reside in a separate thread running at 60Hz.

Finally, it is also possible to:

  • Pause the emulation by pressing the spacebar.
  • Increase the game’s frequency by pressing the Up arrow. (Doesn’t affect the timers)
  • Decrease the game’s frequency by pressing the Down arrow. (Doesn’t affect the timers)
  • Toggle sprite wrapping on/off, as some games require wrapping, and others not (via arguments).

Overall, this was a nice project to study and mess with, maybe some day I will tackle a more complex emulator.

More information, including the project’s source code, is available here

Updated: