diff --git a/Makefile b/Makefile index d174260..0f33271 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,7 @@ run: $(ROM) a.out: main.o interrupt.o vectors.o platform.o apple2rom.cfg $(LIB) $(CC65)/ld65 -C apple2rom.cfg -m main.map --dbgfile main.dbg interrupt.o vectors.o platform.o main.o $(LIB) + awk -f rom_usage.awk < main.map clean: rm -f *.o *.lst a.out platform.s main.s $(LIB) tmp.lib diff --git a/rom_usage.awk b/rom_usage.awk new file mode 100644 index 0000000..bcc2f26 --- /dev/null +++ b/rom_usage.awk @@ -0,0 +1,14 @@ +# Pipe main.map into this to get ROM size info. + +/^CODE/ { code_start = ("0x" $2) + 0 } + +/^RODATA/ { rodata_end = ("0x" $3) + 0 } + +/^VECTORS/ { vectors_start = ("0x" $2) + 0 } + +END { + code = rodata_end - code_start + 1 + all = vectors_start - code_start + printf "%d of %d ROM bytes (%d%%) used\n", code, all, code*100/all +} +