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
+75
View File
@@ -0,0 +1,75 @@
# Обзор примеров
Релиз содержит 27 примеров в каталоге `examples/`. Каждый — самодостаточная
демо-программа с комментариями (использовались как regression-тесты при разработке).
## Сборка примера
```sh
cd examples/hello
make
```
Результат — `hello.exe` рядом с `hello.c` через `examples/example.mk`.
## Категории
### Hello world / основы
* **`hello`** — stdio + conio Turbo-C-стиль цвета
* **`argv`** — парсинг argv в crt0
* **`conio`** — smoke test conio API
* **`attrprob`** — пробинг байта атрибутов Sprinter
### Файловый ввод-вывод
* **`cat`** — читает и печатает TEST.TXT
* **`seek`** — 32-битный lseek по файлу в 100 КБ
* **`ls`** — листинг каталога через ffirst/fnext
* **`filetest`** — FILE* стримы (`fopen`/`fread`/`fwrite`/`fclose`)
* **`stattest`** — `stat`/`fstat` для файлов и каталогов
* **`openenv`** — флаги open() + environment variables
### Память и банки
* **`malloc`** — стресс-тест heap (200+ allocations)
* **`mem_test`** — page allocator + `bank_read`/`bank_write`
* **`banked`** — banked-код в W3 (huge mode)
* **`bankedbg`** — banked-код в W1 (big mode)
* **`banklocl`** — bank-local статические данные и BSS
### Мышь
* **`mouse`** — драйвер в текстовом режиме
* **`gfx_mous`** — мышь с пользовательским bitmap-курсором в графическом режиме
### Графика
* **`gfx_demo`** — 320×256×256: линии, прямоугольники, fill через accelerator
* **`gfx_d16`** — 640×256×16: те же примитивы в 16-цветном режиме
* **`gfx_text`** — bitmap-текст на графическом экране
### Прочее
* **`errno`** — errno / strerror / perror
* **`timedir`** — дата/время + листинг каталога
* **`ptime`** — POSIX time API (time / localtime / mktime)
* **`strtest`** — `<string.h>` тест (из SDCC's z80.lib)
* **`stdlib`** — `<stdlib.h>` тест (qsort / rand / strtol / etc.)
* **`assrtest`** — assert()
* **`rt_test`** — runtime helpers (sleep, setjmp, atexit)
## Example.mk
Каждый пример использует `examples/example.mk`. Минимальный Makefile:
```makefile
PROJ_ROOT := $(abspath $(CURDIR)/../..)
EXAMPLE := my_app
include $(PROJ_ROOT)/examples/example.mk
```
Опциональные параметры (задаются до `include`):
```makefile
MEMORY := huge # по умолчанию tiny
STACK_SIZE := 4096 # по умолчанию ~1278
EXTRA_SRCS := helper.c util.c # дополнительные .c в той же папке
EXTRA_FLAGS := --bank 1=engine.c --debug # pass-through в sprinter-cc
```
Используйте этот template для своих программ.