summaryrefslogtreecommitdiff
path: root/crystal.py
diff options
context:
space:
mode:
authorBryan Bishop <kanzure@gmail.com>2012-05-16 14:37:30 -0500
committerBryan Bishop <kanzure@gmail.com>2012-05-16 14:37:30 -0500
commit69d502d6cf97759415024fc307ecc9b1ffe83c8a (patch)
treef67a642cf9aeb0a74cea743770db66f71b22eb52 /crystal.py
parent87e6810337a9838d2894ee1b8db7a2efd9caf11a (diff)
tool to help narrow down the problem in a bank
original-commit-id: 34c6b38da6026b3a877c68541d0d7bd0ec1373e9
Diffstat (limited to 'crystal.py')
-rw-r--r--crystal.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/crystal.py b/crystal.py
index 245659c..c32724c 100644
--- a/crystal.py
+++ b/crystal.py
@@ -5962,6 +5962,14 @@ class Asm:
#make sure the file ends with a newline
fh.write("\n")
+def list_things_in_bank(bank):
+ objects = []
+ for blah in script_parse_table.items():
+ object = blah[1]
+ if hasattr(object, "address") and calculate_bank(object.address) == bank:
+ objects.append(object)
+ return objects
+
def list_texts_in_bank(bank):
""" Narrows down the list of objects
that you will be inserting into Asm.
@@ -6032,6 +6040,27 @@ def dump_asm_for_movements_in_bank(bank, start=0, end=100):
asm.dump()
print "done dumping movements for bank $%.2x" % (bank)
+def dump_things_in_bank(bank, start=50, end=100):
+ """ is helpful for figuring out which object is breaking that bank.
+ """
+ # load and parse the ROM if necessary
+ if rom == None or len(rom) <= 4:
+ load_rom()
+ run_main()
+
+ things = list_things_in_bank(bank)[start:end]
+
+ # create a new dump
+ asm = Asm()
+
+ # start the insertion process
+ asm.insert_multiple_with_dependencies(things)
+
+ # start dumping
+ asm.dump()
+
+ print "done dumping things for bank $%.2x" % (bank)
+
def index(seq, f):
"""return the index of the first item in seq
where f(item) == True."""