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.
- Repository: GitHub - tsetseggames/zamgba · GitHub
- Pong Demo Source: zamgba/demo/engine/pong.zig at main · tsetseggames/zamgba · GitHub
- Standalone Consumer Example: GitHub - fuzhouch/consumezamgba: Example of consuming [zamgba](https://github.com/fuzhouch/zamgba) · GitHub (shows how to use ZamGBA as an external dependency)
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.halmaps hardware registers cleanly with type safety;zamgba.engineprovides 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 Zigcomptimefunctions. You do not need external patching tools likegbafix—a singlezig buildoutputs a valid.gbaROM. Fixed24_8withcomptime_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.