Add support for decimal formatting.

This commit is contained in:
Maxim Poliakovski 2021-03-22 15:18:34 +01:00
parent 7a9e446434
commit 7c35ecbd11

View File

@ -156,6 +156,15 @@ class ROMDisassembler:
print("dc.l\t0x%X" % struct.unpack('>I', self.rom_data[offset:offset+4])) print("dc.l\t0x%X" % struct.unpack('>I', self.rom_data[offset:offset+4]))
else: else:
print("INVALID SIZE!") print("INVALID SIZE!")
elif format == 'dec':
if size == 1:
print("dc.b\t%d" % struct.unpack('>B', self.rom_data[offset:offset+1]))
elif size == 2:
print("dc.w\t%d" % struct.unpack('>H', self.rom_data[offset:offset+2]))
elif size == 4:
print("dc.l\t%d" % struct.unpack('>I', self.rom_data[offset:offset+4]))
else:
print("INVALID SIZE!")
elif format == 'offset': elif format == 'offset':
dest_offset = struct.unpack('>I', self.rom_data[offset:offset+4])[0] dest_offset = struct.unpack('>I', self.rom_data[offset:offset+4])[0]
if dest_offset in self.rom_db['annot_items']: if dest_offset in self.rom_db['annot_items']: