Follow reference assembler syntax in output of thingamajig_disasm.py
This commit is contained in:
parent
0fc5da3483
commit
677f31ea91
|
@ -76,7 +76,7 @@ def segment(binary, origin):
|
||||||
def disasm(binary, origin = 0):
|
def disasm(binary, origin = 0):
|
||||||
for addr, raw, contents in segment(binary, origin):
|
for addr, raw, contents in segment(binary, origin):
|
||||||
if type(contents) == Data:
|
if type(contents) == Data:
|
||||||
statement = f'db 0x{contents.byte:02x}'
|
statement = f'data {contents.byte:02x}'
|
||||||
else:
|
else:
|
||||||
mnemonic = opcodes[contents.opcode].mnemonic
|
mnemonic = opcodes[contents.opcode].mnemonic
|
||||||
fields = []
|
fields = []
|
||||||
|
@ -85,9 +85,9 @@ def disasm(binary, origin = 0):
|
||||||
if opcodes[contents.opcode].ry:
|
if opcodes[contents.opcode].ry:
|
||||||
fields.append(f'r{contents.ry}')
|
fields.append(f'r{contents.ry}')
|
||||||
if contents.immediate is not None:
|
if contents.immediate is not None:
|
||||||
fields.append(f'#0x{contents.immediate:02x}')
|
fields.append(f'#{contents.immediate:02x}')
|
||||||
elif opcodes[contents.opcode].addr:
|
elif opcodes[contents.opcode].addr:
|
||||||
fields.append(f'0x{contents.addr:04x}')
|
fields.append(f'{contents.addr:04x}')
|
||||||
|
|
||||||
if mnemonic == 'store':
|
if mnemonic == 'store':
|
||||||
fields = ', '.join(reversed(fields))
|
fields = ', '.join(reversed(fields))
|
||||||
|
|
Loading…
Reference in New Issue