gbz80disasm: don't read data where there is none

This commit is contained in:
yenatch 2013-06-28 16:06:39 -04:00
parent 3a1f843e78
commit fee0f0d6a4
1 changed files with 10 additions and 7 deletions

View File

@ -550,6 +550,8 @@ end_08_scripts_with = [
##0x18, #jr ##0x18, #jr
###0xda, 0xe9, 0xd2, 0xc2, 0xca, 0xc3, 0x38, 0x30, 0x20, 0x28, 0x18, 0xd8, 0xd0, 0xc0, 0xc8, 0xc9 ###0xda, 0xe9, 0xd2, 0xc2, 0xca, 0xc3, 0x38, 0x30, 0x20, 0x28, 0x18, 0xd8, 0xd0, 0xc0, 0xc8, 0xc9
] ]
discrete_jumps = [0xda, 0xe9, 0xd2, 0xc2, 0xca, 0xc3]
relative_jumps = [0x38, 0x30, 0x20, 0x28, 0x18, 0xc3, 0xda, 0xc2] relative_jumps = [0x38, 0x30, 0x20, 0x28, 0x18, 0xc3, 0xda, 0xc2]
relative_unconditional_jumps = [0xc3, 0x18] relative_unconditional_jumps = [0xc3, 0x18]
@ -789,12 +791,13 @@ def output_bank_opcodes(original_offset, max_byte_count=0x4000, include_last_add
number = byte1 number = byte1
number += byte2 << 8 number += byte2 << 8
pointer = get_global_address(number, bank_id) if current_byte not in call_commands + discrete_jumps + relative_jumps:
if pointer not in data_tables.keys(): pointer = get_global_address(number, bank_id)
data_tables[pointer] = {} if pointer not in data_tables.keys():
data_tables[pointer]['usage'] = 0 data_tables[pointer] = {}
else: data_tables[pointer]['usage'] = 0
data_tables[pointer]['usage'] += 1 else:
data_tables[pointer]['usage'] += 1
insertion = "$%.4x" % (number) insertion = "$%.4x" % (number)
result = find_label(insertion, bank_id) result = find_label(insertion, bank_id)
@ -848,7 +851,7 @@ def output_bank_opcodes(original_offset, max_byte_count=0x4000, include_last_add
keep_reading = False keep_reading = False
is_data = False #cleanup is_data = False #cleanup
break break
elif offset not in byte_labels.keys() or offset in data_tables.keys(): elif offset not in byte_labels.keys() and offset in data_tables.keys():
is_data = True is_data = True
keep_reading = True keep_reading = True
else: else: