My first Zig project, NESkwik: A cross-platform NES emulator

Around some time last year I’ve decided to give Zig a try and the best way to learn a new language is to build a project with it. So after spending some time thinking about what to build, I’ve decided to build an emulator because I was always curious to know how emulators worked, thus NESkwik was born. I’ve decided to do a NES emulator because it uses an 8-bit CPU which is a simple CPU architecture to implement.

I’ve tried to use the least amount of dependencies as possible, this lead me to creating my own immediate mode UI library with Clay which turned out pretty great, if you’re curious to see how it looks to create some UI with it, you can take a look it here. The renderer of the project was built using SDL3.

Currently, the emulator has 5 types of cartridges implemented which gives around 1900 “playable” games, that’s the majority of the NES game library. Disclaimer: I’ve only tested a few games and did not play them from start to finish, so the 1900 number is very theoretical.

This was a very fun project to work on and is probably the first side project that I have finish, and it’s usable :slight_smile: .

So, if you ever need to play a NES game give NESkwik a try, it works on Linux, Windows, Android and maybe MacOS (haven’t tested it), here’s the link for it: https://github.com/LaBatata101/NESkwik.

Media

AI / LLM usage disclosure

I’ve used AI to help debug problems in the emulator code, there was a few typos in bitwise expressions that caused a lot of accuracy problems. And, to help increase the emulator accuracy to pass Blargg’s ROM tests.

As for using AI to write code, I mostly used to write the UI code, which I refactored most of it because the code was just too bad.

6 Likes