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
+226
View File
@@ -0,0 +1,226 @@
ORG 0x7e00
;EXE-file header:
DW 5845h ; EXE Signature
DB 45h ; Reserved (EXE type)
DB 00h ; Version of EXE file
DW 0200h ; Code offset
DW 0000h
DW 0000h ; Primary loader size or 0 (no primary loader)
DW 0000h ; Reserved
DW 0000h ; Reserved
DW 0000h ; Reserved
DW start ; Loading address
DW start ; Starting address (register PC)
DW 0BFFFh ; Stack address (register SP)
DS 490 ; Reserved
;code of program
start: LD A,81h ;используем режим 320х256
LD BC,0050h ;B - номер видео страницы C - функция SETVMOD
RST 10h ;установить видео режим
JP C,VMError ;если ошибка флаг C установлен
IN A,(0e2h) ;читаем номер страницы установленной в 3 окно ЦП
LD (OldPage),A ;сохраняем в ячейку памяти
LD A,50h ;номер страницы видео памяти
OUT (0e2h),A ;устанавливаем его в 3 окно ЦП
LD IX,rndSeed
LD BC,0DFBDh
LD A,0
OUT (C),A
getSec: LD BC,0FFBDh
IN A,(C)
AND A
JR Z,getSec
SLA A
SLA A
LD (IX),A
LD B,0FFh
LD HL,buffStars
initStLoop1: CALL rndNumber
LD (HL),A
INC HL
DJNZ initStLoop1
LD IX,buffStars
LD IY,scrollSin
mainLoop: DI
LD A,15
LD (color),A
CALL printStars
EI
HALT
XOR A
LD (color),A
CALL printStars
CALL scrollStars
LD A,(IY)
AND A
CALL Z,initMove
LD B,A
moveLoop: PUSH BC
CALL moveStarsUp
initMoveStars: EQU $-2
POP BC
DJNZ moveLoop
INC IY
LD C,31h ; test keypress
RST 10h
JR Z,mainLoop
CP 1Bh ; ESC is pressed?
JR NZ,mainLoop
LD A,(OldPage) ;восстанавливаем предыдущую страницу
OUT (0e2h),A ;устанавливаем ее в 3 окно ЦП
LD A,03h ;текстовый режим
LD BC,0050h ;первая страница, функция SETVMOD
RST 10h ;устанавливаем
exit: LD BC,0041h ;функция EXIT корректный выход в DOS
RST 10h
RET ;вызываем
VMError: LD HL,ErrMess ;сообщение об ошибки
LD BC,005ch ;выводим
RST 10h
JR exit
printStars: PUSH IX
XOR A
LD B,0FFh
printStLoop: LD HL,color
LD D,0C0h
LD E,(IX)
OUT (89h),A
PUSH BC
LDI
POP BC
INC A
INC IX
DJNZ printStLoop
POP IX
RET
scrollStars: PUSH IX
PUSH HL
LD B,0FFh/3
scrollStLoop: LD HL,initSpeed
LD A,(IX)
ADD A,(HL)
LD (IX),A
INC IX
INC HL
LD A,(IX)
ADD A,(HL)
LD (IX),A
INC IX
INC HL
LD A,(IX)
ADD A,(HL)
LD (IX),A
INC IX
DJNZ scrollStLoop
POP HL
POP IX
RET
moveStarsUp: LD HL,buffStars+1
LD DE,buffStars
LD A,(DE)
LD BC,0FEh
LDIR
LD (DE),A
LD HL,initSpeed+1
LD DE,initSpeed
LD A,(DE)
LD BC,2
LDIR
LD (DE),A
RET
moveStarsDown: LD HL,buffStars+0FEh
LD DE,buffStars+0FFh
LD A,(buffStars+0FFh)
LD BC,0FFh
LDDR
LD (buffStars),A
LD HL,initSpeed+1
LD DE,initSpeed+2
LD A,(initSpeed+2)
LD BC,3
LDDR
LD (initSpeed),A
RET
initMove: LD A,(flMove)
AND A
JR Z,moveUp
LD IY,moveStarsUp
XOR A
LD (flMove),A
LD (initMoveStars),IY
JR endInitMove
moveUp: LD IY,moveStarsDown
LD A,1
LD (flMove),A
LD (initMoveStars),IY
endInitMove: LD IY,scrollSin
LD A,(IY)
RET
rndNumber: LD IX,rndSeed
LD D,(IX)
LD A,(IX+2)
LD (IX+3),A
LD A,(IX+1)
LD (IX+2),A
LD (IX+1),D
LD A,(IX+3)
LD E,A
SLA A
SLA A
SLA A
XOR E
LD E,A
SRL A
SRL A
SRL A
SRL A
SRL A
XOR E
LD E,A
SRL D
SRL D
SRL D
SRL D
SRL D
LD A,D
XOR D
XOR E
LD (IX),A
RET
ErrMess: DB "Error set video mode!",0dh,0ah,00h
OldPage: DB 00h
color: DB 15
initSpeed: DB 1,2,3
flMove DB 0
rndSeed: DB 18,43,3,73
scrollSin: DB 1,1,1,1,1,2,1,2,1,2,2,2,2,3,2,2,3,3,2,3,3,3,3,3,3,3,3,3,3
DB 3,3,3,3,3,3,3,3,3,3,2,3,3,2,2,3,2,2,2,2,1,2,1,2,1,1,1,1,1,0
buffStars: DS 256