N64 Kernel/SDK
Zig, MIPS, Kernel, RSP Microcode, Transpiler, Rendering, Tools
libptero is an open-source SDK for the Nintendo 64, written from scratch in Zig.
Booting
This project contains a custom bootloader which handles hardware initialization and loading the initial program into memory. This can be tricky because main system memory and the CPU cache are not online yet. Writes must be 32 bits wide, making logs a bit tricky to write. Once main system memory is up, it loads an ELF program from ROM.
Once I could draw to the framebuffer, the first thing I did was port a ray tracer I had already written in Zig to run on the N64. The required changes were minimal.

Crash Screen
Normally on a crash, you’d only get the address and registers. I thought it would be cool to unwind the stack trace and provide a source map. I used Zig std’s existing DWARF tools to create that map and optionally include it in the ROM. On a panic or CPU exception, a crash screen shows the stack trace with source, along with registers and a memory viewer.

ZSP
The RSP is the N64’s vector coprocessor, and its microcode is usually written in assembly. I created a language that transpiles into RSP microcode. All RSP code is currently direct ports from libdragon and Tiny3D. Eventually I’d like to write my own microcode to really understand the system. The RDP queue, geometry, fonts, skinning and audio mixer all run as ZSP overlays.

Zero Dependencies, Easy Builds
All you need is Zig in order to build ROMs and use the pipeline tools. You can compile from Win, Mac, or Linux.
N64 homebrew usually means building a MIPS GCC cross-toolchain from source or running one in Docker. Zig ships its own cross-compiler, so it targets the N64’s MIPS CPU out of the box, and the asset pipeline tools are built by the same zig build.
Features
- 3D rendering on the RSP with lighting and skeletal animation
- Asset pipeline for glTF models, textures and VADPCM audio
- ROM streaming for models, textures and music
- Hardware profiler and a USB deploy tool