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

90 lines
1.2 KiB
NASM

;[]=====================================[]
; ‚뢮¤ ¢ ¤¥áïâ¨ç­®¬ ä®à¬ â¥ (32-bit)
; ¢ ¡ãä¥à áâப¨ (ॣ."de")
; ¢å®¤:
; hl = áâ.à §àï¤, hl'= ¬«.à §àï¤
; de = ¡ãä¥à áâப¨
IntToChar32:
exx
ld bc,0CA00h ; 1.000.000.000
exx
ld bc,3B9Ah
exx
ld ix,tmp1
res 7,(ix+0)
call GetLen32
ld bc,0E100h ; 100.000.000
exx
ld bc,05F5h
exx
call GetLen32
ld bc,9680h ; 10.000.000
exx
ld bc,98h
exx
call GetLen32
ld bc,4240h ; 1.000.000...9.999.999
exx
ld bc,0Fh
exx
call GetLen32
ld bc,86A0h ; 100.000...999.999
exx
ld bc,1
exx
call GetLen32
; ¢ë¢®¤ 16-bit (hl'= 0)
IntToChar16:
ld bc,10000 ; 10.000...99.999
exx
ld bc,0
exx
call GetLen32
ld bc,1000 ; 1.000..9.999
call GetLen16
DigitToChar:
ld bc,100 ; 100..999
call GetLen16
ld bc,10 ; 10..99
call GetLen16
ld a,l
add a,"0"
ld (de),a
ret
tmp1: db 0
GetLen32:
ld a,2Fh
or a
glen32_loc1:
inc a
sbc hl,bc
exx
sbc hl,bc
exx
jr nc,glen32_loc1
add hl,bc
exx
adc hl,bc
exx
glen32: cp "0"
jr z,glen32_loc2
set 7,(ix+0)
glen32_loc2:
bit 7,(ix+0)
ret z
ld (de),a
inc de
ret
GetLen16:
ld a,2Fh
or a
glen16_loc1:
inc a
sbc hl,bc
jr nc,glen16_loc1
add hl,bc
jr glen32