stdgba
April 14, 2026 ยท View on GitHub
stdgba is a modern C++23 library for Game Boy Advance development.
It is a low-level toolkit, not a game engine: typed hardware register wrappers, BIOS helpers, fixed-point and angle math, DMA/video/input APIs, test and benchmark harnesses, compile-time format/music/embed pipelines, and optimized runtime routines for ARM7TDMI targets.
Why stdgba
- C++23 APIs designed for real GBA constraints (tight CPU, RAM, and VRAM budgets)
- Header-first public interface in
include/gba/with optimized.s/.cppruntime code - Strong compile-time tooling (
constevalparsers/compilers for formats, music, timers, etc.) - Emulator-friendly test and benchmark workflows for repeatable ROM validation
- Practical abstractions without hiding hardware details
Quick example
#include <gba/bios>
#include <gba/interrupt>
#include <gba/peripherals>
int main() {
gba::irq_handler = {};
gba::reg_dispstat = {.enable_irq_vblank = true};
gba::reg_ie = {.vblank = true};
gba::reg_ime = true;
while (true) {
gba::VBlankIntrWait();
}
}
Requirements
- CMake 3.27+
- ARM GNU Toolchain (
arm-none-eabi) for GBA cross-compilation
Current development is validated against ARM GNU Toolchain (arm-none-eabi) and gba-toolchain CMake toolchain (experimental branch).
Core modules
gba/fixed_point,gba/angle: deterministic arithmetic types for game mathgba/video,gba/sprite,gba/color,gba/peripherals: display and register-layer APIsgba/dma,gba/timer,gba/interrupt: hardware control and scheduling primitivesgba/testing,gba/benchmark: ROM-native validation and cycle measurementgba/music,gba/format,gba/embed: compile-time authoring pipelinesgba/save,gba/overlay,gba/memory: cartridge persistence and memory helpersgba/codegen: Runtime ARM instruction generation with zero-overhead patching
Repository layout
include/gba/- public headers (extensionless facade headers)include/gba/bits/- implementation detailssource/- optimized assembly and C++ runtime unitstests/- one ROM test target pertest_*.cppbenchmarks/- performance comparisons and measurement harnesses
CI and documentation
- CI (
.github/workflows/ci.yml) builds test ELFs and runs them withfelixjones/github-mgba-rom-test. - The Book (
book/) contains detailed documentation and examples, built withmdBookand published to felixjones.github.io/stdgba.
License
stdgba is distributed under the zlib license. See LICENSE.