DiscoC is a freestanding systems programming language and a compiler, assembler, and linker for specialized hardware. Its C-like syntax has explicit rules for small integers, banked memory, hardware access, and target capabilities. It is not an ISO C implementation.
The toolchain is written in C++23, with an experimental C++14 DOS cross-build. SuperFX programs can be compiled into real SNES execution payloads without LLVM.
Experimental — v0.2.0 is published. The release retains explicit
-O0,-O1,-O2, and-Ospolicies. The language remains Baseline 0.1; syntax, ABI, and object format may change before 1.0. Generated code is not guaranteed to be optimal. A linked.binis a fixed-origin GSU payload, not a complete SNES ROM.
Native tools: Windows MSVC AMD64, Windows MinGW AMD64, Linux x86_64, macOS arm64. Also available: exact source, SNES demos, and experimental DOS (DOS runtime unverified).
Verify downloads with SHA256SUMS. Build identity and the evidence archive accompany the tools. Read the platform requirements and exact-source validation for the tag/package commit relationship, recorded checks and reproduction commands. See the final release notes; RC records remain historical, not final-release evidence.
| Target | Current support |
|---|---|
gsu / superfx |
Compilation, assembly, relocatable objects, linking, and ROM/RAM execution payloads. |
spc700 |
Frontend analysis, capability diagnostics, and verified IR; no executable backend yet. |
Select the target through the CLI or discoc.toml. Hardware-specific operations
are capability-checked. The three tools are discc (compiler/project builder),
discas (assembler), and discld (linker).
With a C++23 compiler, CMake 3.21+, and Ninja, run from the repository root on Linux/macOS or a Windows MSVC Developer shell:
cmake --preset release
cmake --build --preset release
ctest --preset releaseWindows MinGW-w64 users with g++ and mingw32-make on PATH use:
cmake --preset release-mingw
cmake --build --preset release-mingw
ctest --preset release-mingwExecutables are in build/<preset>/bin (.exe on Windows). Add that directory
to your shell's PATH. See Building DiscoC for prerequisites,
Debug presets, Make/build helpers, direct GCC/Clang builds, and DOS cross-builds.
With discc on PATH, build the included example from the repository root:
discc build --config examples/multifile/discoc.tomlInside your own project, discc build reads the local discoc.toml.
import "math.dc"; shares declarations, not pasted source; project builds
discover and compile implementation dependencies once.
Use -O1 for local optimization, -O2 for speed-oriented global optimization,
or -Os for size-oriented output; the default is -O0. CLI settings override
the manifest. Smaller code can be slower: measure your workload.
Follow the two-file tutorial to create a project, export byte-exact final assembly, and understand the SNES host boundary. See project manifests for configuration and GSU loading before executing a payload.
DiscoC exposes the GSU's plotting state directly:
// Inside a function, with a bitmap selected and the host configured:
plot {
color 5;
at (10, 20); // cursor.x = 10; cursor.y = 20;
for (word i = 0; i < 16; i++) {
pixel; // PLOT draws and increments cursor.x in hardware.
}
flush; // RPIX flushes the pixel caches; discard the result.
}cursor.x/y map to R1/R2. Eligible direct ROM byte colors can use GETC;
RAM and computed colors use COLOR. Bitmap declarations describe framebuffer
configuration; the SNES host still configures SCMR/SCBR and the display.
See the complete graphics contract.
Calculated and drawn by SuperFX code generated from DiscoC source, then displayed by a SNES host:
Build the complete ROM and run independent Mesen checks.
Integer fixed-point rotation, cached pixel loops, and a checkerboard calculated at runtime — no pre-rendered geometry frames:
The GIF replays captured poses at 8 fps; its playback rate is not measured ROM throughput. Build, verification, and timing instructions cover all 64 poses and distinguish GSU cycles from completed-image FPS.
The interactive OBJ demo adds a cube and an icosahedral sphere: D-Pad rotation, A to toggle wireframe/filled faces, and Select + Up/Down to resize, using OBJ/4bpp at approximately 21 MHz.
The gem-chess demo renders an 8×8 board and 32 faceted pieces with an orbiting camera in a BG1 bitmap. See its Mesen preview, build instructions and measurement limits. It is a scene viewer, not a chess rules engine or a real-time game.
The example SNES ROMs contain no Nintendo proprietary code, commercial game assets, or Nintendo SDK components. These are emulator demonstrations, not physical-hardware validation.
- Documentation index — guides, contracts, and release records.
- Language specification — the Baseline 0.1 source of truth.
- Examples and libraries — SNES demos, imports, and fixed-point helpers.
- Optimization and benchmarks — policies, reproducible bytes/cycles, and measurement limits.
- Testing — conformance, execution models, sanitizers, and Mesen integration.
- Architecture and roadmap — internals and future work.
- DiscoManOfficial — project author and maintainer.
- k0b3n4irb — hardware-loop and exhaustive switch-return correctness fixes and regression tests.
- araesmojo-eng — independent SuperFX integration testing and origin/runtime feedback in issue #9.
Thanks to everyone reporting bugs, testing programs, and improving the project. See the contributor history, contribution guide, and Code of Conduct. The private conduct-reporting contact is currently pending.
DiscoC is licensed under GNU GPL v3 or later, without warranty. The Code of Conduct has its own CC BY-SA 4.0 attribution.

