mirror of
https://github.com/pret/pokered.git
synced 2024-10-23 15:08:23 +00:00
implement two-byte op codes in gbz80disasm
Previously, two-byte commands in gbz80disasm would not read or allow parameters. This update fixes gbz80disasm to read both the "x" and "?" parameters. x = one-byte parameter ? = two-byte parameter hg-commit-id: 1494e8a88115
This commit is contained in:
parent
7990b5f632
commit
ebcf2a8756
1 changed files with 32 additions and 4 deletions
|
@ -597,12 +597,38 @@ def output_bank_opcodes(original_offset, max_byte_count=0x4000):
|
|||
temp_maybe += ( ord(rom[offset+1]) << 8)
|
||||
if temp_maybe in opt_table.keys():
|
||||
opstr = copy(opt_table[temp_maybe][0])
|
||||
|
||||
output += spacing + opstr.lower() #+ " ; " + hex(offset)
|
||||
|
||||
if "x" in opstr:
|
||||
for x in range(0, opstr.count("x")):
|
||||
insertion = ord(rom[offset + 1])
|
||||
insertion = "$" + hex(insertion)[2:]
|
||||
|
||||
opstr = opstr[:opstr.find("x")].lower() + insertion + opstr[opstr.find("x")+1:].lower()
|
||||
|
||||
current_byte += 1
|
||||
offset += 1
|
||||
if "?" in opstr:
|
||||
for y in range(0, opstr.count("?")):
|
||||
byte1 = ord(rom[offset + 1])
|
||||
byte2 = ord(rom[offset + 2])
|
||||
|
||||
number = byte1
|
||||
number += byte2 << 8;
|
||||
|
||||
insertion = "$%.4x" % (number)
|
||||
|
||||
opstr = opstr[:opstr.find("?")].lower() + insertion + opstr[opstr.find("?")+1:].lower()
|
||||
output += spacing + opstr #+ " ; " + hex(offset)
|
||||
output += "\n"
|
||||
|
||||
current_byte_number += 2
|
||||
offset += 2
|
||||
|
||||
output += spacing + opstr #+ " ; " + hex(offset)
|
||||
output += "\n"
|
||||
|
||||
current_byte_number += 2
|
||||
offset += 2
|
||||
current_byte_number += 1
|
||||
offset += 1
|
||||
elif maybe_byte in opt_table.keys():
|
||||
op_code = opt_table[maybe_byte]
|
||||
op_code_type = op_code[1]
|
||||
|
@ -611,6 +637,8 @@ def output_bank_opcodes(original_offset, max_byte_count=0x4000):
|
|||
#type = -1 when it's the E op
|
||||
#if op_code_type != -1:
|
||||
if op_code_type == 0 and ord(rom[offset]) == op_code_byte:
|
||||
op_str = op_code[0].lower()
|
||||
|
||||
output += spacing + op_code[0].lower() #+ " ; " + hex(offset)
|
||||
output += "\n"
|
||||
|
||||
|
|
Loading…
Reference in a new issue