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:
Vendored
+156
@@ -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
|
||||
Reference in New Issue
Block a user