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

551 lines
14 KiB
Plaintext

;Window interface
;Subprograms of high level.
mblock defb 0 ;# identification of memory block for pages
mpage defb 0 ;# current free page
opened defb 0 ;Quantity of opened windows
numbers defs 10 ;Buffer of numbers of opened windows
win_init
ld c,#3d
ld b,4
rst #10
ld (mblock),a
ret
windraw
;IX-win data
;+
;0,1 - x
;2 - y
;3,4 - Dx
;5 - Dy
;6,7 - Header line address; 0= no header
;8 - SetUp, Don't touch it!!!
; Bit 7 - Safe back screen
; Bit 0 - 4 Number of buttons set for this window.
;9,10 - Addr. of buffer of back screen
;11 - number of memory block for windows buffer
;12 - Number of page in the block (page which include buffer)
;13,14 - Addr. of block of objects descriptions
call hide_cursor
ld h,(ix+1)
ld l,(ix+0)
ld d,(ix+2)
ld b,(ix+4)
ld c,(ix+3)
ld a,(ix+5)
call sqrw
ld h,(ix+7)
ld l,(ix+6)
ld a,h
or l
jr z,windraw1
push hl
ld h,(ix+1)
ld l,(ix+0)
inc hl
inc hl
ld d,(ix+2)
inc d
inc d
ld a,10
ld b,(ix+4)
ld c,(ix+3)
dec bc
dec bc
dec bc
dec bc
ld e,1
call fbox
pop iy
ld h,(ix+1)
ld l,(ix+0)
inc hl
inc hl
inc hl
ld b,(ix+2)
inc b
inc b
inc b
ld c,7
call pline
windraw1
;Painting objects
ld h,(ix+14)
ld l,(ix+13)
push ix
push hl
pop ix
call windraw_objects
pop ix
; call v_mouse
call unhide_cursor
ret
windraw_objects
;Loop. Calculating: what is the object?, then send it to the right subprogram
;At the last, chack: is it all objects?
ld a,(ix+0)
cp #FF
ret z
cp 0
jp z,wd_key
cp 1
jp z,wd_spr ;Sprite
cp 2
jp z,wd_inline ;Input text line
; cp 3
; jp z,wd_radio ;Trigger
cp 4
jp z,wd_flag ;Flag
cp 5
jp z,wd_grayarea ;Gray place
cp 6
jp z,wd_txtarea ;White place
cp 7
jp z,wd_txtline ;Text
cp 11
jp z,wd_hr ;Hor. line
cp 12
jp z,wd_vr ;Vert. line
ret
wd_txtline
inc ix
ld h,(ix+4)
ld l,(ix+3)
push hl
pop iy
ld h,(ix+1)
ld l,(ix+0)
ld b,(ix+2)
ld c,0
call pline
inc ix
inc ix
; inc ix
inc ix
inc ix
inc ix
jp windraw_objects
wd_flag
inc ix
ld h,(ix+1)
ld l,(ix+0)
ld d,(ix+2)
ld bc,16
ld a,10
ld iy,check_box
push hl
call putspr
ld h,(ix+4)
ld l,(ix+3)
push hl
pop iy
pop hl
ld de,18
add hl,de
ld b,(ix+2)
ld c,0
call pline
inc ix
inc ix
inc ix
inc ix
inc ix
jp windraw_objects
wd_inline
inc ix
ld h,(ix+1)
ld l,(ix+0)
dec hl
ld d,(ix+2)
dec d
ld b,(ix+4)
ld c,(ix+3)
inc bc
inc bc
ld a,12
call sqrtxt
inc ix
inc ix
inc ix
inc ix
inc ix
jp windraw_objects
wd_txtarea
inc ix
ld h,(ix+1)
ld l,(ix+0)
ld d,(ix+2)
ld b,(ix+4)
ld c,(ix+3)
ld a,(ix+5)
call sqrtxt
inc ix
inc ix
inc ix
inc ix
inc ix
inc ix
jp windraw_objects
wd_grayarea
inc ix
ld h,(ix+1)
ld l,(ix+0)
ld d,(ix+2)
ld b,(ix+4)
ld c,(ix+3)
ld a,(ix+5)
call sqrd
inc ix
inc ix
inc ix
inc ix
inc ix
inc ix
jp windraw_objects
;wd_radio
; inc ix
; ld h,(ix+1)
; ld l,(ix+0)
; ld d,(ix+2)
; ld bc,14
; ld a,10
; ld iy,radio_button
; push hl
; call putspr
; ld h,(ix+4)
; ld l,(ix+3)
; push hl
; pop iy
; pop hl
; ld de,18
; add hl,de
; ld b,(ix+2)
; ld c,0
; call pline
; inc ix
; inc ix
; inc ix
; inc ix
; inc ix
; jp windraw_objects
wd_hr
inc ix
ld h,(ix+1)
ld l,(ix+0)
ld d,(ix+2)
ld b,(ix+4)
ld c,(ix+3)
ld e,11
call horline
ld h,(ix+1)
ld l,(ix+0)
ld d,(ix+2)
ld b,(ix+4)
ld c,(ix+3)
inc d
ld e,10
call horline
inc ix
inc ix
inc ix
inc ix
inc ix
jp windraw_objects
wd_vr
inc ix
ld h,(ix+1)
ld l,(ix+0)
ld d,(ix+2)
ld a,(ix+3)
ld e,11
call verline
ld h,(ix+1)
ld l,(ix+0)
ld d,(ix+2)
ld a,(ix+3)
inc a
ld e,10
call verline
inc ix
inc ix
inc ix
inc ix
jp windraw_objects
wd_key
inc ix
ld h,(ix+1)
ld l,(ix+0)
ld d,(ix+2)
ld bc,52
ld a,12
call sqrw
ld h,(ix+4)
ld l,(ix+3)
ld (wd_key3),hl
ld b,0
wd_key1
ld a,(hl)
or a
jp z,wd_key2
inc b
inc hl
jp wd_key1
wd_key2
ld de,24
ld c,b
ld b,0
sla c
rlc b
sla c
rlc b
sla c
rlc b
sub de,bc
srl d
rr e
ld h,(ix+1)
ld l,(ix+0)
inc hl
inc hl
add hl,de
ld b,(ix+2)
inc b
inc b
ld c,0
ld iy,0
wd_key3 equ $-2
call pline
ld bc,5
add ix,bc
jp windraw_objects
wd_spr
inc ix
ld h,(ix+7)
ld l,(ix+6)
push hl
pop iy
ld h,(ix+1)
ld l,(ix+0)
ld d,(ix+2)
ld b,(ix+4)
ld c,(ix+3)
ld a,(ix+5)
call putspr
inc ix
inc ix
inc ix
inc ix
inc ix
inc ix
inc ix
inc ix
jp windraw_objects
wintable
defw 0
defw 0
defw 0
defw 0
defw 0
defw 0
defw 0
defw 0
defw 0
defw 0
defw 0
defw 0
defw 0
defw 0
defw 0
defw 0
defw 0
defw 0
defw 0
defw 0
sqrw
;HL - X
;D - Y
;BC - DX
;A - Dy
ld e,9
push hl
push de
push bc
push af
call fbox
pop af
pop bc
pop de
pop hl
ld e,8
push hl
push de
push bc
push af
call box
pop af
pop bc
pop de
pop hl
push hl
push de
push bc
push af
dec bc
ld e,7
call horline
pop af
pop bc
pop de
pop hl
ld e,7
ld b,a
dec b
call verline
ret
sqrtxt
;HL - X
;D - Y
;BC - DX
;A - Dy
ld e,7
push hl
push de
push bc
push af
call fbox
pop af
pop bc
pop de
pop hl
ld e,7
push hl
push de
push bc
push af
call box
pop af
pop bc
pop de
pop hl
push hl
push de
push bc
push af
dec bc
ld e,11
call horline
pop af
pop bc
pop de
pop hl
ld e,11
ld b,a
dec b
call verline
ret
sqrd
;HL - X
;D - Y
;BC - DX
;A - Dy
ld e,9
push hl
push de
push bc
push af
call fbox
pop af
pop bc
pop de
pop hl
ld e,7
push hl
push de
push bc
push af
call box
pop af
pop bc
pop de
pop hl
push hl
push de
push bc
push af
ld e,8
call horline
pop af
pop bc
pop de
pop hl
ld e,8
ld b,a
call verline
ret