ref: 82b8b5121a574b6e29c72a95fd305134fd0a08cf
parent: c78866613882b109bf79294a38c79bdcd1b5bfd7
author: Bryan Bishop <[email protected]>
date: Sun Feb 3 10:10:14 EST 2013
enable labels in gbz80disasm fixes #102
--- a/extras/gbz80disasm.py
+++ b/extras/gbz80disasm.py
@@ -568,8 +568,6 @@
crystal.scan_for_predefined_labels()
def find_label(local_address, bank_id=0):
- return None
-
global all_labels
# keep an integer
@@ -577,17 +575,19 @@
local_address1 = int(local_address.replace("$", "0x"), 16)
else: local_address1 = local_address
- # turn local_address into a string
+ # turn local_address into an integer
if type(local_address) == str:
- if "0x" in local_address: local_address = local_address.replace("0x", "$")
- elif not "$" in local_address: local_address = "$" + local_address
- if type(local_address) == int:
- local_address = "$%.x" % (local_address)
- local_address = local_address.upper()
+ if "0x" in local_address:
+ local_address = local_address.replace("0x", "$")
+ elif "$" in local_address:
+ local_address = local_address.replace("$", "")
+ if type(local_address) == str:
+ local_address = int(local_address, 16)
+
for label_entry in all_labels:
- if label_entry["local_pointer"].upper() == local_address:
- if label_entry["bank_id"] == bank_id or (local_address1 < 0x8000 and (label_entry["bank_id"] == 0 or label_entry["bank_id"] == 1)):
+ if label_entry["address"] == local_address:
+ if label_entry["bank"] == bank_id or (local_address1 < 0x8000 and (label_entry["bank"] == 0 or label_entry["bank"] == 1)):
return label_entry["label"]
return None