summaryrefslogtreecommitdiff
path: root/pokemontools/parse_consecutive_strings.py
diff options
context:
space:
mode:
Diffstat (limited to 'pokemontools/parse_consecutive_strings.py')
-rw-r--r--pokemontools/parse_consecutive_strings.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/pokemontools/parse_consecutive_strings.py b/pokemontools/parse_consecutive_strings.py
new file mode 100644
index 0000000..4c864ba
--- /dev/null
+++ b/pokemontools/parse_consecutive_strings.py
@@ -0,0 +1,25 @@
+import sys
+
+import crystal
+
+rom = crystal.load_rom()
+
+addr = int(sys.argv[1], 16)
+count = int(sys.argv[2]) if len(sys.argv) > 2 else 256
+label_prefix = sys.argv[3] if len(sys.argv) > 3 else "UnknownString"
+
+ex = None
+
+for i in range(count):
+ try:
+ string = crystal.PokedexText(addr)
+ asm = string.to_asm()
+ except Exception as ex:
+ break
+ print label_prefix+str(i)+": ; "+hex(addr)
+ print "\t"+asm
+ print
+ addr = string.last_address
+
+print "; "+hex(addr)
+if ex: raise ex