c71e249a4e
First substantive commit: the entire Sprinter C compiler tree on top of
the bare README+gitignore initial commit.
What's in here:
bin/sprinter-cc — driver script invoking SDCC + linker + mkexe
libc/ — Sprinter-specific libc layer over ESTEX/BIOS
(conio, gfx, io, mem, stdio + headers)
runtime/ — crt0 variants (default/small/banked/minimal)
+ heap + bank trampolines
toolchain/ — mkexe (SprintEXE packer, C + tests)
examples/ — 30 demo programs (gfx, file I/O, env, time, …)
lib/Makefile — builds the libc archive (sprinter.lib)
docs/ — converted Sprinter manuals + asm reference samples
third_party/ — solid-c reference compiler dump + sdcc setup script
release_docs/ — packaging / release notes
gitignore overhaul:
• Drop dangerous blanket patterns: *.asm (would hide docs/samples/*.asm)
and *.exe (case-insensitive match was hiding third_party/solid-c/*.EXE
on macOS APFS). Replaced with examples/*/*.{asm,exe,…} and lib/*.lib.
• Restore tracking of toolchain/mkexe/tests/{one,big}.bin — those are
INPUT fixtures, not build outputs.
• Collapse the duplicated SDCC/C/Sdcc sections into one section per
concern (build outputs / vendored / OS-junk).
• Add .sprinter-cc-*/, build/ (catches lib/build/ too), .claude/.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2.5 KiB
2.5 KiB
sprinter-cc — compiler driver
One-line entrypoint to the entire toolchain. Takes .c files plus options
and emits a SprintEXE.
Synopsis
sprinter-cc -o OUT.exe SRC.c [more.c ...] [options]
Options
Memory layout
| Flag | Description |
|---|---|
--memory MODE |
tiny (default), small, big, huge, manual. See memory_modes.md. |
--memory-manual SPEC |
For --memory manual: comma-separated KEY=VAL list, e.g. CODE=W2,DATA=W2,BANKED=W3. |
--stack-size N |
Bytes reserved for the stack. Default ≈ 1278. Larger value reduces the heap. |
Code organisation
| Flag | Description |
|---|---|
--bank N=FILE.c |
Compile FILE.c into bank N (1..15). Repeatable. Functions in banked files need the __banked qualifier. |
--crt0=TYPE |
Override startup file: default / minimal / banked / small. Normally chosen automatically by the memory mode. |
Diagnostics
| Flag | Description |
|---|---|
--debug |
Prepends DEBUG_RT = 1 to crt0 and passes -DDEBUG_RT to SDCC. Exposes runtime introspection symbols like _w2_self_allocated. |
-v |
Verbose — echo every sub-command. |
-h / --help |
Built-in help. |
Passthrough
| Flag | Description |
|---|---|
-I PATH |
Extra include path. |
-Wl FLAG |
Pass FLAG to the linker. |
--mkexe FLAG |
Pass FLAG to mkexe (e.g. --mkexe -p --mkexe 0 for zero-padded banks). |
-L 0xADDR |
Override load address. |
-E 0xADDR |
Override entry address. |
-S 0xADDR |
Override initial stack address. Default 0xBFFE. |
Examples
Smallest possible build:
sprinter-cc -o hello.exe hello.c
Larger program (doesn't fit in 14 KB):
sprinter-cc --memory small -o big.exe big.c
Multi-bank game:
sprinter-cc --memory huge -o game.exe \
main.c --bank 1=engine.c --bank 2=ai.c --bank 3=audio.c
Custom stack size:
sprinter-cc --stack-size 4096 -o app.exe app.c
Under the hood
- Picks crt0 based on
--memory(and--bankpresence). - Assembles crt0 (with optional
DEBUG_RT/BANK_W1prepended). - Assembles
heap_top.s(custom value if--stack-size). - Compiles every source
.cto.relvia SDCC. - Compiles bank sources with
--codeseg/--constseg/--dataseg BANK_n. - Compiles
runtime/bank.strampoline (if banks are used). - Links everything to
.ihx, runscheck_banks.pyto enforce 16 KB bank limits. - Calls
toolchain/mkexe/mkexeto wrap the.ihxas SprintEXE.
Per-build artefacts go in .sprinter-cc-<basename>/ next to the output.