.phony: all
all: sys
-bios: bnkbios3.spr
-
+map: bnkbios3.map
sys: cpm3.sys
+bios: bnkbios3.spr
$(OBJ): $(INC)
exit $${ERROR}
endef
+PSEG = $(call SEGMENT-ADDR, 1)
+DSEG = $(call SEGMENT-ADDR, 2)
+
+#(call SEGMENT-ADDR,SEGNUM)
+SEGMENT-ADDR = $(shell dd if=cpm3.sys bs=128 count=1 skip=1 2>/dev/null |\
+ awk -vn=$(strip $1) '/BNKBIOS3/ {if (++seg == n) print $$3}')
+
+bnkbios3.map: cpm3.sys
+ ld80 -o /dev/null -ms bnkbios3.map -P $(PSEG) -D $(DSEG) $(OBJ)
+
+
cpm3.sys: bnkbios3.spr
zxcc gencpm -auto
@echo