AWK script to dump ROM size info.

This commit is contained in:
Lawrence Kesteloot 2018-07-31 16:05:56 -07:00
parent 1fb7e76f3f
commit 0254577c96
2 changed files with 15 additions and 0 deletions

View File

@ -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

14
rom_usage.awk Normal file
View File

@ -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
}