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
+156
View File
@@ -0,0 +1,156 @@
; ‚室ï騥 ä㭪樨:
;
; movmem
; memset
; memcpy
; memmove
; memcmp
;
MODULE movmem
;
; "mem.h"
; ”ã­ªæ¨ï movmem ª®¯¨àã¥â len ¡ ©â ¨§ source ¢ destin.
; …᫨ ¨á室­ ï ¨ १ã«ìâ¨àãîé¨ï áâப  ¯¥à¥ªà뢠îâáï,
; ª®¯¨à®¢ ­¨¥ ¢á¥-à ¢­® ¯à®¨§¢®¤¨âáï ª®à४⭮.
;
; ”ã­ªæ¨ï setmem ãáâ ­ ¢«¨¢ ¥â ¯¥à¢ë¥ len ¡ ©â ¡«®ª  addr
; ¢ §­ ç¥­¨¥ value.
;
; void movmem(*source, *destin, len)
; void setmem(*addr, len, char value)
;
setmem_::
ld a,b
or c
ret z
ld (hl),e ; value
ld e,l
ld d,h
inc de
dec bc
movmem_::
ld a,b
or c
ret z
ldir
ret
ENDMODULE
MODULE memset
;
; "mem.h"
; ”ã­ªæ¨ï § ¯®«­ï¥â ¯¥à¢ë¥ count ¡ ©â ¡ãä¥à  dest ᨬ¢®«®¬ "c".
; ”ã­ªæ¨ï ¢®§¢à é ¥â 㪠§ â¥«ì ­  ¡ãä¥à dest.
;
; void *memset(*dest, c, count)
;
memset_::
push hl
call setmem_##
pop hl ; ¢¥à­ãâì  ¤à¥á dest
ret
ENDMODULE
MODULE memcpy
;
; "mem.h"
; ”ã­ªæ¨ï ª®¯¨àã¥â count ¡ ©â®¢ ¨§ source ¢ dest.
; …᫨ ­¥ª®â®àë¥ ãç á⪨ source ¨ dest ¯¥à¥ªà뢠îâáï, äã­ªæ¨ï
; £ à ­â¨àã¥â, çâ® ¡ ©âë ¨§ ¯¥à¥ªà뢠¥¬®£® ãç á⪠, ¯à¨­ ¤«¥-
; ¦ é¨¥ source, ¡ã¤ãâ ᪮¯¨à®¢ ­ë ¯¥à¥¤ ¯¥à¥§ ¯¨áìî.
; ”ã­ªæ¨ï ¢®§¢à é ¥â 㪠§ â¥«ì ­  dest.
;
; void *memcpy(*dest, *source, count)
;
memcpy_::
ld a,b
or c
ret z ; count = 0
push hl
ex de,hl
ldir
pop hl ; ¢¥à­ãâì  ¤à¥á dest
ret
ENDMODULE
MODULE memmove
;
; "mem.h"
; ”ã­ªæ¨ï ªo¯¨àãîâ count ¡ ©â®¢ ¨§ source ¢ dest.
; …᫨ ­¥ªoâoàë¥ o¡« á⨠¢ source ¨ dest ¯¥à¥ªà뢠îâáï, äã­ªæ¨ï
; £ à ­â¨àã¥â, çâo ¨áåo¤­ë¥ source ¡ ©â ¨§ ¯¥à¥ªà뢠î饩áï o¡« áâ¨
; ¡ã¤ãâ áªo¯¨ào¢ ­ë ¯¥à¥¤ ¯¥à¥¯¨á뢠­¨¥¬.
; ”ã­ªæ¨ï ¢®§¢à é ¥â 㪠§ â¥«ì ­  dest.
;
; void *memmove(*dest, *source, count)
;
memmove_::
ld a,b
or c
ret z ; count = 0
push hl
ex de,hl
ld a,d
cp h
jr nz,@1
ld a,e
cp l
@1: jr nc,@2
ldir
pop hl
ret
@2: add hl,bc
ex de,hl
add hl,bc
ex de,hl
lddr
pop hl
ret
ENDMODULE
MODULE memcmp
;
; "mem.h"
; ”ã­ªæ¨ï ¯à®¨§¢®¤¨â ¯®á«¥¤®¢ â¥«ì­®¥ «¥ªá¨£à ä. áà ¢­¥­¨¥
; ¯¥à¢ëå count ¡ ©â®¢ ¨§ buf1 ¨ buf2, ¨ ¯à®¤®«¦ ¥â íâ®, ¯®ª 
; ®­¨ ᮢ¯ ¤ îâ, «¨¡® ¯®ª  ­¥ ¢ë¯®«­¨âáï § ¤ ­­®¥ ª®«¨ç¥á⢮
; áà ¢­¥­¨© count.
; ”ã­ªæ¨ï ¢®§¢à é ¥â §­ ç¥­¨¥, 㪠§ë¢ î饥 ­  ᮮ⭮襭¨¥
; íâ¨å ¡ãä¥à®¢:
; < 0 buf1 < buf2
; = 0 buf1 = buf2
; > 0 buf1 > buf2
;
; int memcmp(*buf1, *buf2, count)
;
memcmp_::
ld a,(de)
sub (hl)
jr nz,@1
inc hl
inc de
dec bc
ld a,b
or c
jp nz,memcmp_
ld h,a ; hl = 0
ld l,a
ret
@1: ld hl,1 ; hl = 1
ret nc
ld hl,-1 ; hl = -1
ret
ENDMODULE