chlo.exposed

back to home

An Oxidized Chip-8 Emulator

I have been an avid user of emulators for a long time, but I didn't have an understanding for how they worked internally. So, I decided to start my journey into emulation by writing a Chip-8 emulator (or interpreter if you want to be pedantic).

Background on Chip-8

As I alluded to earlier, the Chip-8 is in-fact not an emulator, but instead an interpreted programming language. It was developed in the 70's by Joseph Weisecker. I will be calling it an emulator from here on our just for the sake of simplicity, as that was the goal of this project from the jump.

Design of Emulator

I used Tobias Langhoff's excellent breakdown of the system when designing my program. My design philosophy is to follow a loose data-oriented paradigm to utilize Rust's amazing type system. The Chip-8's internals are stored in a struct. During a cpu cycle, the instruction is parsed and sent off to a function that represents the given opcode. This allows me to do some type checking to guarentee that the program doesn't crash from an incorrect integer cast. Rendering is completely separate from the Chip-8 and is handled with the SDL2 rust bindings.