Add full compiler toolchain, libc, examples and reference docs

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>
This commit is contained in:
2026-06-03 16:13:21 +03:00
parent f542608b3f
commit c71e249a4e
404 changed files with 75155 additions and 58 deletions
+63
View File
@@ -0,0 +1,63 @@
/*
* gfx_font.c — bitmap-font management shared by the 256- and 16-colour
* text renderers.
*
* Format (ZX-Spectrum-compatible): 256 glyphs × 8 rows × 1 byte = 2 KB,
* INTERLEAVED row-major —
* offset = row * 256 + char_code
* so row 0 of every glyph occupies bytes 0x000..0x0FF, row 1 occupies
* 0x100..0x1FF, etc. Each row byte is MSB-first (bit 7 = leftmost px).
*
* The default source is BIOS WIN_GET_ZG (fn 0xB8) — the active system
* character generator. Programs may override with gfx_set_font().
*
* Lazy initialisation: gfx_text_256.c / gfx_text_16.c call _gfx_font_ensure
* on first use so a pure-graphics program doesn't pay the BIOS call.
*
* The font pointer and the buffer are exported to the two text renderers
* via _gfx_font_ptr (extern), which always points at valid data once
* _gfx_font_ensure has been called.
*/
#include <gfx.h>
#include <stdint.h>
#define FONT_BYTES 2048
static uint8_t _gfx_font_buf[FONT_BYTES];
const uint8_t *_gfx_font_ptr = _gfx_font_buf;
static uint8_t _gfx_font_loaded = 0;
/* BIOS WIN_GET_ZG (0xB8): DE = destination, returns 2 KB. */
static void bios_get_zg(uint8_t *dest) __naked
{
(void)dest;
__asm
push ix ; BIOS clobbers IX
ex de, hl ; DE = dest (HL was arg)
xor a ; font 0 (default)
ld c, #0xB8
rst #0x08
pop ix
ret
__endasm;
}
void gfx_load_default_font(void)
{
bios_get_zg(_gfx_font_buf);
_gfx_font_ptr = _gfx_font_buf;
_gfx_font_loaded = 1;
}
void gfx_set_font(const uint8_t *font)
{
_gfx_font_ptr = font;
_gfx_font_loaded = 1;
}
/* Called from text renderers — loads the default font on first use. */
void _gfx_font_ensure(void)
{
if (!_gfx_font_loaded) gfx_load_default_font();
}