
Kotlin CHIP-8 (badlogic) ( Let’s write a Chip8 emulator in Kotlin) The code is available on GitHub, and here are a couple of other implementations you can also check out: Once I was done with the Rust implementation, I just copy-pasted the whole thing into Javascript, which you can check out at the end of this post. :))īy writing the interpreter in Rust and taking advantage of the unit test features, it was very easy to build up the CHIP-8 VM, and I only ended up with a couple of pesky logic bugs due to being unsure about the implementation in a couple of places and due to a misuse of the slicing syntax. (After spending some time with Swift, I would also wish for no semicolons and maybe nicer optional unwrapping, but, at least with the semicolons, that ship has probably already sailed.

In fact, the only real beef I have with Rust is that it’s still young, so its support for mobile development is not quite up to par with the C and C++ support provided by Apple and Google.

Unlike C and C++, it also has some nice features that make it feel modern and fresh, like memory safety without garbage collection, super-charged enums, and a great build system that has built-in support for dependencies, unit testing, and more. Like C and C++, Rust compiles down to native code and runs without the overhead of a VM while also giving you full access to the platform underneath. In the past, I would have dabbled in C or C++ but as time goes by, I feel that it makes more sense to focus on Rust. I decided to write the emulator using Rust, a systems programming language that I’ve been dabbling in on and off whenever I feel like taking a break from Java. There are lots of resources for the CHIP-8 and it’s also a simple implementation, which means it can be done over a weekend or even faster. To overcome that, I took a look into what it would take to write a toy emulator.Īfter briefly considering an NES emulator as my first project, I discovered the CHIP-8 VM and decided that would make a really neat first project.

In university, the furthest down we got was C++ and we didn’t spend that much time there, so everything under that has always felt a little like black magic to me.

Lately, I’ve been more interested in learning about emulators and interpreters, down to the way that CPUs work at a low level.
