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
+37
View File
@@ -0,0 +1,37 @@
/*
* sprinter_mem.h — banking-aware page allocator and bank-data accessors.
*
* For data that doesn't fit in window 2's heap, allocate physical pages
* directly through ESTEX EMM and access them via bank_read / bank_write
* (which swap window 3 internally).
*
* mem_alloc_pages(N) — reserve N contiguous 16 KB pages, return block id.
* mem_free_block(id) — release a previously-allocated block.
* mem_get_page(id, i) — translate (block, page-index) to physical page.
* mem_info(&total, &free) — query EMM about total/free 16 KB pages.
*
* bank_load_byte / bank_store_byte — single-byte access via W3.
* bank_read / bank_write — bulk copy between far page and a near buffer.
*
* The bank_* helpers live in HOME so they are always reachable; they save
* the previous W3 page, swap to the target, do the work, restore W3.
*/
#ifndef SPRINTER_MEM_H
#define SPRINTER_MEM_H
#include <stdint.h>
/* ESTEX EMM allocator wrappers. */
uint8_t mem_alloc_pages(uint8_t n); /* 0 = failure */
void mem_free_block (uint8_t blk_id);
uint8_t mem_get_page (uint8_t blk_id, uint8_t idx);
void mem_info (uint16_t *total, uint16_t *free_pages);
/* Far-page accessors (always-mapped HOME, swap W3 internally). */
uint8_t bank_load_byte (uint8_t phys_page, uint16_t off_in_window);
void bank_store_byte(uint8_t phys_page, uint16_t off_in_window, uint8_t v);
void bank_read (uint8_t phys_page, uint16_t off, void *dst, uint16_t n);
void bank_write(uint8_t phys_page, uint16_t off, const void *src, uint16_t n);
#endif