cpm: initial cbios
[z80.git] / z80 / cpm / Makefile
diff --git a/z80/cpm/Makefile b/z80/cpm/Makefile
new file mode 100644 (file)
index 0000000..4567c42
--- /dev/null
@@ -0,0 +1,40 @@
+# makefile
+
+PROG   = cbios
+OBJS   = cbios.rel
+
+AS     = sdasz80
+CC     = sdcc -mz80 --all-callee-saves --no-std-crt0
+LD     = sdldz80
+
+.PHONY: all clean
+all: dump.hex
+
+dump.hex: cbios.hex cpm20.hex
+       srec_cat -Output -Intel --address-length=2 \
+               cbios.hex -Intel cpm20.hex -Intel > dump.hex
+
+cpm20.hex: cpm20.sys
+       objcopy -I binary -O ihex --change-addresses=0x3400 cpm20.sys cpm20.hex
+
+$(PROG).hex: $(PROG).ihx
+       @echo -e "\tMV\t$@"
+       @mv $< $@
+
+$(PROG).ihx: $(OBJS)
+       @echo -e "\tLD\t$@"
+       @$(LD) -i $(OBJS)
+
+%.rel: %.c
+       @echo -e "\tCC\t$@"
+       @$(CC) -c -o $@ $^
+
+%.rel: %.S
+       @echo -e "\tAS\t$@"
+       @$(AS) -l -p -o $@ $^
+
+clean:
+       @echo -e "\tCLEAN"
+       rm -f *.asm *.hex *.lk *.lst *.map *.noi *.rel *.sym
+       rm -f cpm20.hex dump.hex
+