summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan Bishop <kanzure@gmail.com>2012-06-19 22:54:20 -0500
committerBryan Bishop <kanzure@gmail.com>2012-06-19 22:54:20 -0500
commitaf3d9eb02f97debc10a95f6fabbfea03665e4137 (patch)
tree900b97687297443e3a5e151bd5bb0f9f4a6d0f7e
parentcd6d6b94373752b63feceebf7753d78738eb0c65 (diff)
implement a formatted-with-labels version of the opcode line
original-commit-id: 96ca472fc922ef0d235a0c2e7104265de42893af
-rw-r--r--romstr.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/romstr.py b/romstr.py
index d318540..481b645 100644
--- a/romstr.py
+++ b/romstr.py
@@ -222,6 +222,8 @@ class Asm:
asm_command["format"] = opstr
asm_command["opnumberthing"] = optype
+ opstr2 = None
+
if "x" in opstr:
for x in range(0, opstr.count("x")):
insertion = ord(rom[offset + 1])
@@ -248,8 +250,18 @@ class Asm:
# be shown during asm output.
insertion = "$%.4x" % (number)
+ base_opstr = copy(opstr)
+
opstr = opstr[:opstr.find("?")].lower() + insertion + opstr[opstr.find("?")+1:].lower()
+ # This version of the formatted string has labels. In
+ # the future, the actual labels should be parsed
+ # straight out of the "main.asm" file.
+ target_address = number % 0x4000
+ insertion = "asm_" + hex(target_address)
+ opstr2 = base_opstr[:base_opstr.find("?")].lower() + insertion + base_opstr[base_opstr.find("?")+1:].lower()
+ asm_command["formatted_with_labels"] = opstr2
+
current_byte_number += 2
offset += 2