# DIAPO -- automatic TMS9918 slideshow (Graphics II) from sdcard/TMS.
# Drives the microSD MCU directly (dev/lib/sd/sd.asm is .include'd — it has no .export)
# and links tms9918_pad.asm for the silicon-strict cushion. Emits the
# SD-CARD-OS-tagged binary into sdcard/TMS/ (tag "#060300" = BIN @ $0300).
#
# `#` is a Make comment even in filenames, so build the literal via H.
H    := \#
INC  := -I ../../../dev/lib/tms9918 -I ../../../dev/lib/sd
# EXTRA_ASM is the ONE place the modules this sketch assembles are named,
# and it is written with LITERAL relative paths on purpose: the POM1
# DevBench reads it without expanding `$(VAR)`, so a bespoke variable
# here would build one binary under `make` and another in the Bench.
# Pinned by ctest sketch_manifests_sync.
EXTRA_ASM := ../../../dev/lib/tms9918/tms9918_pad.asm
PAD  := $(EXTRA_ASM)
CFG  := ../../../dev/cc65/apple1_tmsutil.cfg
OUT  := ../../../sdcard/TMS

.PHONY: all clean test
all:
	ca65 $(INC) -o DIAPO.o DIAPO.asm
	ca65 $(INC) -o pad.o "$(PAD)"
	@mkdir -p "$(OUT)"
	ld65 -C "$(CFG)" DIAPO.o pad.o -o "$(OUT)/DIAPO$(H)060300"
	@echo "[DIAPO] built DIAPO$(H)060300 in $(OUT)"

clean:
	rm -f DIAPO.o pad.o

test:
	@echo "[DIAPO] no smoke test wired -- verified via manual @R DIAPO on-device"
