Looking for new projects to sharpen my Rust skills, I came across a Reddit post where someone mentioned CHIP-8. CHIP-8 is an interpreted low-level programming language and virtual machine specification that is very commonly used as a “Hello world!” project of sorts for people to get their feet wet with emulator programming. It is simple enough to be able to implement a fully-featured emulator in a couple of sessions, but it has all the key parts of a real machine, to the point that are many projects that implement CHIP-8 directly in hardware.
I have since implemented my own CHIP-8 emulator in Rust (see repository here) with support for sound, display scaling, configurable colors, and more. But this text is not about it (I’ll write about my implementation in a future post). Today I want to fully describe the CHIP-8 machine, because I had fun implementing it, and I like it so much that I want to have it here for my future reference. In this guide, every instruction is accompanied with a small pseudo-code block to help understand the interpreter’s intended behavior to the more technically inclined reader.