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>
51 lines
3.7 KiB
Markdown
51 lines
3.7 KiB
Markdown
# Headers
|
||
|
||
Everything you `#include` lives under `libc/include/`.
|
||
|
||
## Standard C
|
||
|
||
| Header | Source | Provides |
|
||
|---|---|---|
|
||
| `<stdio.h>` | our libc + SDCC | `printf`, `puts`, `putchar`, `getchar`, `sprintf`, `FILE *`, `fopen`/`fread`/.../`fclose`, plus `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`, full `strXxx` family |
|
||
| `<ctype.h>` | SDCC z80.lib | `tolower`, `toupper`, `isalnum`, `isdigit`, ... |
|
||
| `<math.h>` | SDCC z80.lib | `sinf`, `cosf`, `sqrtf`, ... |
|
||
| `<errno.h>` | our libc | `errno` + error constants + `strerror` |
|
||
| `<setjmp.h>` | our libc | `setjmp` / `longjmp` |
|
||
| `<assert.h>` | SDCC | `assert` macro |
|
||
| `<unistd.h>` | our libc | `read`, `write`, `close`, `lseek`, `unlink`, `SEEK_SET`/`CUR`/`END` |
|
||
| `<fcntl.h>` | our libc | `open`, `creat`, `O_RDONLY`/`O_WRONLY`/`O_CREAT`/etc. |
|
||
| `<sys/stat.h>` | our libc | `stat`, `fstat`, `struct stat` |
|
||
| `<time.h>` | our libc | `getdatetime`, `setdatetime` + POSIX `time`/`localtime`/`gmtime`/`mktime`/`asctime`/`ctime` |
|
||
|
||
## Sprinter-specific
|
||
|
||
| Header | Provides |
|
||
|---|---|
|
||
| `<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>` | Graphics for 320×256×256 and 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`, plus all `*16` variants for 16-color mode, font management via `gfx_load_default_font`/`gfx_set_font` |
|
||
| `<mouse.h>` | Full 14-function driver wrapper: `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`, plus `mouse_cursor_t` and `mouse_state_t` structs |
|
||
| `<dir.h>` | `chdir`, `getcwd`, `mkdir`, `rmdir`, `ffirst`, `fnext`, `ffblk` struct |
|
||
| `<sprinter.h>` | Raw port numbers, ESTEX/BIOS function-number constants, `__sfr` intrinsics for 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 — pulls in standard headers and adds `BOOL`/`uint`/`WORD`/`f_point` types, `setmem`/`movmem` aliases, `inp`/`outp`, `enable`/`disable`, `min`/`max`, `home()`, `seek`/`tell`/`remove`, `_ffirst`, `ms_*` mouse aliases, etc. |
|
||
|
||
## Quick lookup: I want to ...
|
||
|
||
* **Print text** → `<stdio.h>` (`printf` / `puts` — fast, no colour) or
|
||
`<conio.h>` (`cprintf` / `cputs` — applies `textcolor`).
|
||
* **Read a key** → `<conio.h>`: `getch()` (blocking, no echo), `getche()` (echo),
|
||
`kbhit()` (non-blocking poll).
|
||
* **Open / read / write files** → `<unistd.h>` + `<fcntl.h>` (POSIX) or
|
||
`<stdio.h>` (`fopen` family).
|
||
* **List a directory** → `<dir.h>`: `ffirst` / `fnext`.
|
||
* **Draw pixels** → `<gfx.h>`.
|
||
* **Allocate memory** → `<stdlib.h>`: `malloc` / `free` / `calloc` / `realloc`.
|
||
* **Get current time** → `<time.h>`: `getdatetime` or POSIX `time`/`localtime`.
|
||
* **Read mouse** → `<mouse.h>`.
|
||
* **Read an env var** → `<sprinter.h>`: `getenv` / `putenv`.
|
||
* **Set text colour** → `<conio.h>`: `textcolor(COLOR_YELLOW)`,
|
||
`textbackground(COLOR_BLUE)`, or `textattr(COLOR(fg, bg))`.
|