chiark / gitweb /
do not show plat edges as rails
[trains.git] / pic.make
index 8cd8f77199868efdfe41659f207395bd0948bc95..d445442b7335a2ee17a4b33b84c7d9d2e41cf69f 100644 (file)
--- a/pic.make
+++ b/pic.make
 #   perpicNUMBER.hex                   idlocsNUMBER.o  config.o
 
 #ASFLAGS=      -Dmclock=20000 -Dsclock=20000
-CLOCKS=                -Dmclock=20000 -Dsclock=5000
+CLOCKS=                -Dmclock=32000 -Dsclock=4000
 ASFLAGS=       $(CLOCKS)
 
 HEXMERGER=     $(CEBPIC)merge-hex
 MERGEHEX=      ./$^ $o
 
+PIC=           18f458
 LINK=          gplink -m -o $@ $^
-ASSEMBLE=      gpasm -p 18f458 $(ASFLAGS)
-DOASSEMBLE=    $(ASSEMBLE) -c $< && mv $*.lst $*-asm.lst
+ASSEMBLE=      gpasm -p$(PIC)  $(ASFLAGS)
+DOASSEMBLE=    $(ASSEMBLE) -c $< && mv $*.lst $*+asm.lst
+
+PIC_HEADER=    /usr/share/gputils/header/p$(PIC).inc
 
 %.o:           %.asm $(INCLUDES)
                $(DOASSEMBLE)
 
+TIA_DIR=       ../iwjpictest
+TIA_TIA=       $(TIA_DIR)/to-insn-aliases
+TIA_ALIASES=   $(TIA_DIR)/insn-aliases.inc
+TIA=           $(TIA_TIA) -A $(TIA_ALIASES) -H $(PIC_HEADER)
+
+%.disasm:      %.hex %.map $(TIA_TIA) $(TIA_ALIASES)
+               gpdasm -p$(PIC) $(word 1,$+) >$@.tmp
+               $(TIA) -M $(word 2,$+) <$@.tmp $o
+               @rm $@.tmp
+
 .PRECIOUS:     %.o
 
 pic-clean:
-               -rm -f -- *~ *.new *.tmp
+               -rm -f -- *~ *.new *.tmp *.disasm
                -rm -f *.hex *.cod *.lst *.o *.map