GB#

  • Language C# / .NET 10
  • Started Aug 2026
  • License MIT, open source
  • Position Solo Developed
View on GitHub

Project Description

GB# is a statically compiled, hardware-aware C# development environment for the Game Boy and Game Boy Color. You write a constrained subset of C#, and GB# turns it into a real .gb or .gbc ROM.

It is not ".NET for Game Boy". There is no runtime, JIT or garbage collector on the cartridge. GB# analyses your code with Roslyn, lowers it to a small intermediate representation, emits conservative C, and hands that to GBDK-2020 to build the ROM:

C# → Roslyn → GB# validation → GB# IR → C → GBDK-2020 / SDCC → ROM

The bet is that modern language ergonomics don't require a modern runtime. A line like Sprites[0].X = x; erases to a single OAM store, and the arithmetic stays 8-bit.

Development

GB# ships as a global dotnet tool on NuGet. Four commands take you from nothing to a running game: install the tool, let gbsharp doctor --fix fetch the pinned toolchain and emulator, create a project from a template, and run it.

Phases 0 through 6 of the roadmap are implemented: the compiler pipeline, the language core, the framework, the asset pipeline, ROM banking, developer tooling, and cost and stack analysis. The repo includes nine working sample games, from Hello World to a banked 64 KB cartridge.

My Game Boy Color puzzler OXO is built with GB#, and was the first complete game to put it to the test.

Documentation
NuGet package

  • Roslyn-Based Compiler
    • Validates the C# subset and reports every rule as a diagnostic
    • The same rules run as editor analyzers, so mistakes show up as you type
    • A backend-agnostic IR, so a future GBA backend is a new backend rather than a rewrite
  • Cost Reporting & Profiling
    • Every build reports WRAM, ROM banks and estimated cycles against the 70,224-cycle frame budget
    • gbsharp profile measures the real numbers on a bundled emulator
  • Asset Pipeline & Banking
    • PNG decoding, 2bpp conversion, tile deduplication and palettes
    • Automatic ROM banking for cartridges larger than 32 KB
  • Publishing
    • Publish a game as a standalone Windows build or a single self-contained .html file
    • Tests build real ROMs and run them on the emulator