summaryrefslogtreecommitdiff
path: root/tools/free_space.awk
blob: 1f2b04415dc9ae483e105e3b65733c901538a10f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/usr/bin/awk -f

# Usage: tools/free_space.awk pokecrystal.map

BEGIN {
	total = free = 16384 * 128
}
/^  SECTION: \$[0-7]/ {
	free -= strtonum("0x" substr($3, 3))
}
END {
	printf "Free space: %d/%d (%.2f%%)\n", free, total, free * 100 / total
}