diff options
author | Bryan Bishop <kanzure@gmail.com> | 2013-08-03 16:10:52 -0500 |
---|---|---|
committer | Bryan Bishop <kanzure@gmail.com> | 2013-08-03 16:10:52 -0500 |
commit | 28490230cf68f8045fc63a8c7d3de19c7c1d3bcd (patch) | |
tree | c4d1a3acbc7d34b77a890f8e19a8d7253917be8c /pokemontools/parse_consecutive_strings.py | |
parent | a14c36eadb75ea3d6fbc4cb3f382d7c9785d9fe9 (diff) |
make a basic python module
Diffstat (limited to 'pokemontools/parse_consecutive_strings.py')
-rw-r--r-- | pokemontools/parse_consecutive_strings.py | 25 |
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 |