Files
snark13 c71e249a4e 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>
2026-06-03 16:13:21 +03:00

4.4 KiB
Raw Permalink Blame History

Заголовки

Все #include живут в libc/include/.

Стандартный C

Заголовок Источник Что предоставляет
<stdio.h> наша libc + SDCC printf, puts, putchar, getchar, sprintf, FILE *, fopen/fread/.../fclose, плюс hex8/16/32, dec8/16/32, gets
<stdlib.h> SDCC z80.lib malloc, free, calloc, realloc, atoi, atof, atol, strtol, qsort, bsearch, rand, srand, abs, div, exit, ...
<string.h> SDCC z80.lib memcpy, memcmp, memset, memchr, memmove, вся семья strXxx
<ctype.h> SDCC z80.lib tolower, toupper, isalnum, isdigit, ...
<math.h> SDCC z80.lib sinf, cosf, sqrtf, ...
<errno.h> наша libc errno + константы ошибок + strerror
<setjmp.h> наша libc setjmp / longjmp
<assert.h> SDCC макрос assert
<unistd.h> наша libc read, write, close, lseek, unlink, SEEK_SET/CUR/END
<fcntl.h> наша libc open, creat, O_RDONLY/O_WRONLY/O_CREAT/...
<sys/stat.h> наша libc stat, fstat, struct stat
<time.h> наша libc getdatetime, setdatetime + POSIX time/localtime/gmtime/mktime/asctime/ctime

Sprinter-специфичные

Заголовок Что предоставляет
<conio.h> putch, cputs, cprintf, kbhit, getch, getche, clrscr, gotoxy, wherex/y, wrchar, rdchar, textcolor, textbackground, textattr, get_videomode, set_videomode, COLOR_* enum, KEEP_EXIST_ATTR
<gfx.h> Графика для 320×256×256 и 640×256×16: gfx_init/gfx_done, gfx_pal_load/gfx_pal_set, gfx_clear, gfx_putpixel, gfx_hline/gfx_vline, gfx_rect/gfx_fill_rect, gfx_line, gfx_text/gfx_putchar, все варианты *16 для 16-color режима, управление шрифтом через gfx_load_default_font/gfx_set_font
<mouse.h> Полная обёртка из 14 функций драйвера: mouse_init/mouse_show/mouse_hide/mouse_read/mouse_goto/mouse_bounds_*/mouse_text_cursor/mouse_load_cursor/mouse_get_cursor/mouse_set_sensitivity/mouse_get_sensitivity_*/mouse_video_mode_changed/mouse_refresh, плюс структуры mouse_cursor_t и mouse_state_t
<dir.h> chdir, getcwd, mkdir, rmdir, ffirst, fnext, структура ffblk
<sprinter.h> Сырые номера портов, константы ESTEX/BIOS function numbers, __sfr intrinsics для paging, print_hex, getenv, putenv
<sprinter_exit.h> exit, _exit, atexit
<sprinter_mem.h> mem_alloc_pages, mem_free_block, mem_get_page, mem_info, bank_read, bank_write, bank_load_byte, bank_store_byte
<sprinter_compat.h> Solid-C compatibility shims — подтягивает стандартные заголовки и добавляет типы BOOL/uint/WORD/f_point, алиасы setmem/movmem, inp/outp, enable/disable, min/max, home(), seek/tell/remove, _ffirst, mouse-алиасы ms_* и т.д.

Быстрая навигация: я хочу...

  • Вывести текст<stdio.h> (printf / puts — быстро, без цвета) или <conio.h> (cprintf / cputs — применяет textcolor).
  • Прочитать клавишу<conio.h>: getch() (blocking, без эхо), getche() (с эхо), kbhit() (non-blocking poll).
  • Открыть / прочитать / записать файл<unistd.h> + <fcntl.h> (POSIX) или <stdio.h> (семья fopen).
  • Прочитать каталог<dir.h>: ffirst / fnext.
  • Нарисовать пиксели<gfx.h>.
  • Выделить память<stdlib.h>: malloc / free / calloc / realloc.
  • Получить текущее время<time.h>: getdatetime или POSIX time/localtime.
  • Прочитать мышь<mouse.h>.
  • Прочитать env var<sprinter.h>: getenv / putenv.
  • Задать цвет текста<conio.h>: textcolor(COLOR_YELLOW), textbackground(COLOR_BLUE), или textattr(COLOR(fg, bg)).