summaryrefslogtreecommitdiff
path: root/extras
diff options
context:
space:
mode:
Diffstat (limited to 'extras')
-rw-r--r--extras/analyze_texts.py27
-rw-r--r--extras/pretty_text.py5
2 files changed, 28 insertions, 4 deletions
diff --git a/extras/analyze_texts.py b/extras/analyze_texts.py
index 30a6b5dc..fa21e3a5 100644
--- a/extras/analyze_texts.py
+++ b/extras/analyze_texts.py
@@ -401,6 +401,7 @@ def text_pretty_printer_at(start_address, label="SomeLabel"):
#start with zero please
byte_count = 0
+ output = ""
had_text_end_byte = False
had_text_end_byte_57_58 = False
had_db_last = False
@@ -431,7 +432,7 @@ def text_pretty_printer_at(start_address, label="SomeLabel"):
first_line = False
#p1 = command["pointer"][0]
#p2 = command["pointer"][1]
- output += "\n" + spacing + "TX_FAR _" + label
+ output += "\n" + spacing + "TX_FAR _" + label + " ; " + hex(command["pointer"])
byte_count += 4 #$17, bank, address word
had_db_last = False
elif command["type"] == 0x9: #TX_RAM_HEX2DEC
@@ -467,6 +468,26 @@ def text_pretty_printer_at(start_address, label="SomeLabel"):
pass #this is ok
elif command["type"] == 0x50 and had_text_end_byte:
pass #this is also ok
+ elif command["type"] == 0x0b:
+ if first_line:
+ output = "\n" + label + ": ; " + hex(start_address)
+ first_line = False
+ if had_db_last:
+ output += ", $0b"
+ else:
+ output += "\n" + spacing + "db $0B"
+ byte_count += 1
+ had_db_last = True
+ elif command["type"] == 0x11:
+ if first_line:
+ output = "\n" + label + ": ; " + hex(start_address)
+ first_line = False
+ if had_db_last:
+ output += ", $11"
+ else:
+ output += "\n" + spacing + "db $11"
+ byte_count += 1
+ had_db_last = True
else:
print "ERROR in command: " + hex(command["type"])
had_db_last = False
@@ -549,9 +570,9 @@ def text_pretty_printer_at(start_address, label="SomeLabel"):
output += "\n"
include_newline = "\n"
- if output[-1] == "\n":
+ if len(output)!=0 and output[-1] == "\n":
include_newline = ""
- output += include_newline + "; " + hex(start_address) + " + " + str(byte_count) + " bytes"
+ output += include_newline + "; " + hex(start_address) + " + " + str(byte_count) + " bytes = " + hex(start_address + byte_count)
print output
return (output, byte_count)
diff --git a/extras/pretty_text.py b/extras/pretty_text.py
index 6d0cb61d..9e669aca 100644
--- a/extras/pretty_text.py
+++ b/extras/pretty_text.py
@@ -8,7 +8,10 @@ def main():
usage = "usage: %prog address label"
parser = OptionParser(usage)
(options, args) = parser.parse_args()
- if len(args) != 2:
+ if len(args) == 1:
+ print "usage: python pretty_text.py address label"
+ args.append("UnnamedText_" + (args[0].replace("0x", "")))
+ elif len(args) != 2:
parser.error("we need both an address and a label")
address = int(args[0], 16)
label = args[1]