lol its in c
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

16 lines
584 B

import sys
import re
SIZE = {"ROM0": 0x4000, "ROMX": 0x4000, "WRAM0": 0x2000, "HRAM": 0x007F, "VRAM": 0x4000}
area_re = re.compile(r'([A-Z0-9]+) bank #([0-9a-f]+):\n')
slack_re = re.compile(r' SLACK: \$([0-9a-f]+) byte')
for line in open(sys.argv[1], "rt"):
area = area_re.match(line)
if area:
area_name = area[1]
bank_nr = int(area[2])
slack = slack_re.match(line)
if slack:
used = SIZE[area_name] - int(slack[1], 16)
print("%5s:%2d %04x/%04x (%.1f%%)" % (area_name, bank_nr, used, SIZE[area_name], used * 100 / SIZE[area_name]))