ZamGBA: Pure Zig SDK for Game Boy Advance homebrew (v0.1.0)

ZamGBA


Hi everyone! I have been working on GBA homebrew and wanted to share ZamGBA, a lightweight SDK and 2D engine written in pure Zig. It started as a personal learning project, but I now realize it could become a functional SDK for GBA game development.

Today it reaches v0.1.0. To be honest, this is an early release (no audio drivers or scrolling backgrounds yet), but it is already capable of running a playable classic Pong game.

Design Highlights (v0.1.0)

Just clone the repo and run zig build --optimize=fast to generate 8 *.gba demo ROMs inside zig-out/bin/. You can run them in the mGBA emulator or load them directly onto a retro handheld.

Key design choices in v0.1.0:

  • 2-Tier Architecture: zamgba.hal maps hardware registers cleanly with type safety; zamgba.engine provides input polling, 2D AABB collisions, and the main game loop.
  • Comptime GBA Header (No gbafix): GBA header checksums and logo data are generated directly at compile time via Zig comptime functions. You do not need external patching tools like gbafix—a single zig build outputs a valid .gba ROM.
  • Fixed24_8 with comptime_float: The GBA has no hardware FPU. You write normal float literals in code, and Zig resolves them at compile time with zero runtime float cost.
  • Interrupt-Driven VBlank (waitForVBlank): Uses GBA hardware IRQs instead of a busy loop. This saves battery on real hardware and guarantees a tear-free 60 FPS.

Please go ahead checking my roadmaps from README of my project repo


Supported Zig versions

  • Zig 0.16.0 (Tag: zig-0-16)

AI / LLM usage disclosure

This project heavily uses LLMs (Gemini / Zed Agents) for code generation, including HAL register mappings, engine code, and example games.

While most of the code was generated by LLMs, the system architecture (2-layer HAL/Engine split, Fixed24_8 math with comptime conversion, interrupt-driven VBlank sync), debugging, bug fixes, and emulator testing in mGBA were designed, reviewed, and tested by me.

7 Likes