blob: 42fd3473b2dd987fe37b4b3edc9a73b049d8c662 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#!/usr/bin/env python3
from sys import argv
from charmap import parse_charmap
file = open("DMGAKVJ0.1", "rb").read()
bank = int(argv[1], 16)
addr = int(argv[2], 16)
offset = addr
if bank > 0:
offset += 0x4000 * (bank - 1)
o_charmap, constants = parse_charmap("data/charmap.txt")
charmap = {}
for char in o_charmap:
if o_charmap[char] not in charmap:
charmap[o_charmap[char]] = char
while True:
value = file[offset] | (file[offset + 1] << 8)
offset += 2
if value == 0xffff:
print()
break
elif value == 0xfffe:
print()
continue
if value in charmap:
print(charmap[value], end="")
else:
print("<%02x>" % value, end="")
|