From 28490230cf68f8045fc63a8c7d3de19c7c1d3bcd Mon Sep 17 00:00:00 2001 From: Bryan Bishop Date: Sat, 3 Aug 2013 16:10:52 -0500 Subject: make a basic python module --- pokemontools/parse_consecutive_strings.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 pokemontools/parse_consecutive_strings.py (limited to 'pokemontools/parse_consecutive_strings.py') 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 -- cgit v1.2.3