mirror of
https://github.com/KrisKennaway/pyapple2disk.git
synced 2024-05-28 05:41:33 +00:00
b4ea155b24
Be a bit more robust about dealing with data corruption
18 lines
444 B
Python
18 lines
444 B
Python
import string
|
|
|
|
PRINTABLE = set(string.letters + string.digits + string.punctuation + ' ')
|
|
|
|
def HexDump(data):
|
|
line = []
|
|
for idx, b in enumerate(data):
|
|
if idx % 8 == 0:
|
|
print '$%02x: ' % idx,
|
|
print "%02x" % ord(b),
|
|
if b in PRINTABLE:
|
|
line.append(b)
|
|
else:
|
|
line.append('.')
|
|
if (idx + 1) % 8 == 0:
|
|
print " %s" % ''.join(line)
|
|
line = []
|