Files
Sprinter-SDCC/Makefile
T
snark13 a6fe50e247 libc: IM2 user-ISR, Phase 1 — libc/irq (irq_install/irq_remove) + irqtest
Проще исходного плана (docs/im2_isr_design.md обновлён): отдельный
--memory im2 не понадобился.

- <irq.h>: irq_install(handler) — вызов ~50 Гц только на КАДРОВЫХ
  прерываниях (клавиатура bit0:0x19 и CBL bit7:0xFE отфильтровываются);
  штатный обработчик DSS чейнится ВСЕГДА (SMC-jp, адрес из старой
  IM2-таблицы по регистру I) — клавиатура/SYSTIME/мышь живут
- вектор-таблица: 513 Б BSS + runtime-выравнивание; Sprinter шлёт
  только вектор 0xFF, поэтому jp-заглушка лежит внутри самой таблицы
  по смещению H — без linker-областей и правок crt0
- трамплин: полный сейв обоих наборов+IX/IY вокруг user-handler'а
  (ex af,af' как .db 0x08 — апостроф ломает препроцессор SDCC)
- tiny/big: работает (код в W2); small/huge: EINVAL по проверке
  адресов; irq_remove идемпотентен и висит на atexit (выход без
  снятия = I в памяти умершего процесса = крах шелла); old_I==0 → IM1
- tests/irqtest: тики за 3 с против time() (~50 Гц), живая клавиатура
  под handler'ом, остановка после remove, чистый выход
- docs: im2_isr_design (статус+дельты), libc-reference (<irq.h>), TODO

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-06 21:21:16 +03:00

89 lines
2.8 KiB
Makefile
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Sprinter C Compiler — top-level Makefile
#
# make build host tools, libc archive, all tests, all apps
# make tools build only host tools (mkexe)
# make lib build lib/sprinter.lib (libc archive used by sprinter-cc)
# make tests build all libc feature tests under tests/
# make examples build all real applications under examples/
# make floppy package every .exe + test fixtures into mame/v306/IMG/mc.img
# make check run mkexe unit tests
# make clean remove all build artefacts
# make sdcc download/extract vendored SDCC
#
# Most heavy lifting is delegated to sub-Makefiles.
# Small libc-feature tests (one program per .c-language feature or libc API).
TESTS := hello hello2 simple banked bankedbg banktest strtest cat seek \
malloc mem_test argv errno rt_test openenv ls conio conio2 \
attrprob timedir mouse banklocl stdlib assrtest ptime stattest \
filetest fdmax fbench solidt irqtest dec_test gets stest2 winrest \
bios_text text_palette \
gfx_demo gfx_d16 gfx_text gfx_mous gfx_dbuf
# Larger end-user applications under examples/.
APPS := mdview mdview2
MAME_DIR := mame/v306
FLOPPY_IMG := $(MAME_DIR)/IMG/mc.img
MAKE_DISK := $(MAME_DIR)/make_disk.py
TEST_EXES := $(foreach t,$(TESTS),tests/$(t)/$(t).exe)
APP_EXES := $(foreach a,$(APPS),examples/$(a)/$(a).exe)
ALL_EXES := $(TEST_EXES) $(APP_EXES)
DATA_FILES := \
tests/cat/test.txt \
tests/seek/big.txt \
examples/mdview/SAMPLE.MD
.PHONY: all tools lib tests examples check clean sdcc floppy \
size-check size-baseline $(TESTS) $(APPS)
all: tools lib tests examples
tools:
$(MAKE) -C toolchain/mkexe
lib:
$(MAKE) -C lib
check: tools
$(MAKE) -C toolchain/mkexe check
tests: $(TESTS)
examples: $(APPS)
$(TESTS): tools lib
$(MAKE) -C tests/$@
$(APPS): tools lib
$(MAKE) -C examples/$@
# Generate big.txt if missing (gen_bigfile.py creates 100 KB marker file).
tests/seek/big.txt:
cd tests/seek && python3 gen_bigfile.py big.txt 102400
# Re-pack the MAME floppy image with every built exe + needed data files.
floppy: tests examples tests/seek/big.txt
python3 $(MAKE_DISK) $(FLOPPY_IMG) $(ALL_EXES) $(DATA_FILES)
@echo
@echo "Floppy ready: $(FLOPPY_IMG)"
@echo "Run: cd $(MAME_DIR) && ./run_mame.sh"
# Размерный регресс: сверить _CODE всех программ с docs/size_baseline.tsv.
size-check:
python3 toolchain/size_check.py
# Принять текущие размеры как эталон (после осознанных изменений).
size-baseline:
python3 toolchain/size_check.py --update
clean:
$(MAKE) -C toolchain/mkexe clean
$(MAKE) -C lib clean
@for t in $(TESTS); do $(MAKE) -C tests/$$t clean; done
@for a in $(APPS); do $(MAKE) -C examples/$$a clean; done
sdcc:
bash third_party/setup-sdcc.sh