Add WIP coverage program
This commit is contained in:
parent
fa0cc7ca0e
commit
9576a2a0da
|
@ -1,6 +1,6 @@
|
|||
baserom.gb
|
||||
*.o
|
||||
tetris.gb
|
||||
tools/scan_includes
|
||||
tetris.sym
|
||||
tetris.map
|
||||
*.pyc
|
||||
|
|
4
Makefile
4
Makefile
|
@ -2,7 +2,7 @@ ASMFILES:= $(wildcard src/*.asm)
|
|||
OBJFILES:= $(ASMFILES:.asm=.o)
|
||||
|
||||
tetris.gb: $(OBJFILES)
|
||||
rgblink -O baserom.gb -o tetris.gb -n tetris.sym -d $(OBJFILES)
|
||||
rgblink -O baserom.gb -o tetris.gb -m tetris.map -n tetris.sym -d $(OBJFILES)
|
||||
rgbfix -t "TETRIS" -r 0x00 -n 0x01 -l 0x01 tetris.gb
|
||||
tools/symsort
|
||||
|
||||
|
@ -13,6 +13,6 @@ tetris.gb: $(OBJFILES)
|
|||
verify:
|
||||
@md5sum -c tetris.md5
|
||||
clean:
|
||||
rm tetris.gb tetris.sym $(OBJFILES)
|
||||
rm tetris.gb tetris.sym tetris.map $(OBJFILES)
|
||||
symwatch:
|
||||
tools/symwatch
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/env python3
|
||||
import re
|
||||
|
||||
SECTION_LINE = re.compile(r'SECTION: \$([0-9A-F]{4,4})-\$([0-9A-F]{4,4}) \(\$([0-9A-F]{4,4}) bytes\) \["(.+)"\]')
|
||||
|
||||
MAP_FILE = "tetris.map"
|
||||
|
||||
sections = []
|
||||
with open(MAP_FILE) as f:
|
||||
sections = [l.strip() for l in f if l.strip().startswith("SECTION")]
|
||||
|
||||
coverage = [False for x in range(32768)]
|
||||
def mark(begin,end):
|
||||
global coverage
|
||||
coverage[begin:end] = [True for x in range(end-begin)]
|
||||
|
||||
for section in sections:
|
||||
g = SECTION_LINE.match(section).groups()
|
||||
if int(g[1],16)>0x8000:
|
||||
continue
|
||||
print("Section \"{}\" is from ${} to ${}".format(g[3],g[0],g[1]))
|
||||
mark(int(g[0],16),int(g[1],16))
|
||||
|
||||
print("{:.2%} coverage".format(len([x for x in coverage if x])/32768.))
|
Loading…
Reference in New Issue