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:
@@ -0,0 +1,169 @@
|
||||
|
||||
define TRUE #37 ; scf
|
||||
define FALSE #a7 ; and a
|
||||
|
||||
SLOT0 equ #82
|
||||
SLOT1 equ #a2
|
||||
SLOT2 equ #c2
|
||||
SLOT3 equ #e2
|
||||
|
||||
define ENABLE_MUSIC
|
||||
define MUSIC_LENGTH 1245 ; bytes
|
||||
|
||||
|
||||
jp __start
|
||||
|
||||
|
||||
include "sprinter_libs/BIOS_equ.inc"
|
||||
include "sprinter_libs/DSS_equ.inc"
|
||||
|
||||
include "../../lib/im_lib.asm"
|
||||
include "../../lib/sound/sound_lib.asm"
|
||||
|
||||
include "sprinter_functions.asm"
|
||||
include "macro.asm"
|
||||
|
||||
include "delta.asm"
|
||||
include "im2_handler.asm"
|
||||
|
||||
|
||||
__start:
|
||||
di
|
||||
|
||||
; сохраним указатель стека
|
||||
ld (__saved_sp), sp
|
||||
ld sp, memory_map.stack_addr ; стек должен находиться в адресах #8000-#bfff
|
||||
|
||||
; сохраним дескриптор *.exe файла
|
||||
ld a, (ix-3)
|
||||
ld (exe_file_handle), a
|
||||
|
||||
; сохраним номер физ. страницы, которая подключена в SLOT3
|
||||
in a, (SLOT3)
|
||||
ld (__saved_page_in_slot3), a
|
||||
|
||||
; включим 21 МГц
|
||||
call turbo_on
|
||||
|
||||
; выделим страницу памяти под музыку
|
||||
call try_get_mem_page
|
||||
ld (music_page), a
|
||||
|
||||
; откроем страницу для музыки
|
||||
ld a, (music_page)
|
||||
out (SLOT3), a
|
||||
|
||||
; и загрузим музыку (байт в байт)
|
||||
ld a, (exe_file_handle)
|
||||
ld hl, #c000 ; куда загружаем
|
||||
ld de, MUSIC_LENGTH ; сколько байт пытаемся загрузить
|
||||
ld c, Dss.Read
|
||||
rst ToDSS
|
||||
|
||||
; закроем файл
|
||||
ld a, (exe_file_handle)
|
||||
ld c, Dss.Close
|
||||
rst ToDSS
|
||||
|
||||
; выведем надпись
|
||||
ld hl, s_press_any_key
|
||||
print_str
|
||||
|
||||
;
|
||||
; запускаем прерывания на таймере CTC (взамен кадрового)
|
||||
; музыка инициализируется там же
|
||||
;
|
||||
; включаем страницу с музыкой
|
||||
ld a, (music_page)
|
||||
out (SLOT3), a
|
||||
|
||||
; инициализация прерываний
|
||||
call initialize_interrupts
|
||||
|
||||
;
|
||||
; основной цикл
|
||||
;
|
||||
ei
|
||||
|
||||
; крутимся в дельта-цикле, пока не выставлен флаг delta_exit_flag = TRUE
|
||||
DELTA do_present, do_render, do_logic
|
||||
|
||||
; переход на выход из программы
|
||||
jr do_continue
|
||||
|
||||
|
||||
|
||||
do_present:
|
||||
; поменять экраны местами
|
||||
ret
|
||||
|
||||
|
||||
do_render:
|
||||
; процедура рендера одного кадра
|
||||
; может не помещаться во фрейм
|
||||
ret
|
||||
|
||||
|
||||
do_logic:
|
||||
; процедура обработки логики
|
||||
; гарантированно вызывается 50 раз в секунду,
|
||||
; даже если рендер не укладывается во фрейм
|
||||
|
||||
; проверка нажатия любой кнопки для выхода
|
||||
xor a
|
||||
in a, (#fe)
|
||||
or %11100000
|
||||
inc a
|
||||
ret z
|
||||
|
||||
; установка флага "на выход"
|
||||
ld a, TRUE
|
||||
ld (delta_exit_flag), a
|
||||
ret
|
||||
|
||||
|
||||
do_continue:
|
||||
di
|
||||
|
||||
; выключим CTC прерывания и отключим музыку
|
||||
ld a, (music_page)
|
||||
out (SLOT3), a
|
||||
call disable_interrupts
|
||||
|
||||
; освободим ранее занятые страницы памяти
|
||||
ld a, (music_page)
|
||||
call try_free_mem
|
||||
|
||||
; выведем текстовую строку
|
||||
ld hl, s_byebye
|
||||
print_str
|
||||
|
||||
; почистим буфер клавиатуры
|
||||
ld c, Dss.K_CLEAR
|
||||
ld b, 0
|
||||
rst ToDSS
|
||||
|
||||
; восстановим страницу в SLOT3, которая была там на момент запуска
|
||||
__saved_page_in_slot3: equ $+1
|
||||
ld a, 0
|
||||
out (SLOT3), a
|
||||
|
||||
; восстановим стек, где был
|
||||
__saved_sp: equ $+1
|
||||
ld sp, 0
|
||||
|
||||
jp exit_to_dos
|
||||
|
||||
|
||||
interrupts_count: dw -1
|
||||
|
||||
|
||||
exe_file_handle: db 0
|
||||
music_page: db 0
|
||||
|
||||
|
||||
s_press_any_key: db "Press any key to exit...\r\n",0
|
||||
s_byebye: db "Bye bye! :)\r\n",0
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user