summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan Bishop <kanzure@gmail.com>2012-05-11 16:30:12 -0500
committerBryan Bishop <kanzure@gmail.com>2012-05-11 16:30:12 -0500
commit4fc77cd823307fb351386c9720a91cfd4c1fa6e5 (patch)
tree0c4fc24c8e54f64bb174d628c05fef530c50b668
parentba334bbe1730d39c1a38455ad85ceae0cc5450c0 (diff)
quick tool for dumping a segment of ApplyMovementData objects into a bank
original-commit-id: feab0b56bc77e7788c93e5f16592470dcd8ded60
-rw-r--r--crystal.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/crystal.py b/crystal.py
index bb7576e..e3f4471 100644
--- a/crystal.py
+++ b/crystal.py
@@ -5872,6 +5872,22 @@ def list_texts_in_bank(bank):
return texts
+def list_movements_in_bank(bank):
+ """ Narrows down the list of objects
+ to speed up Asm insertion.
+ """
+ if len(all_movements) == 0:
+ raise Exception, "all_movements is blank.. run_main() will populate it"
+
+ assert bank != None, "list_movements_in_bank must be given a particular bank"
+ assert 0 <= bank < 0x80, "bank doesn't exist in the ROM (out of bounds)"
+
+ movements = []
+ for movement in all_movements:
+ if calculate_bank(movement.address) == bank:
+ movements.append(movement)
+ return movements
+
def dump_asm_for_texts_in_bank(bank, start=50, end=100):
""" Simple utility to help with dumping texts into a particular bank. This
is helpful for figuring out which text is breaking that bank.
@@ -5896,6 +5912,18 @@ def dump_asm_for_texts_in_bank(bank, start=50, end=100):
print "done dumping texts for bank $%.2x" % (bank)
+def dump_asm_for_movements_in_bank(bank, start=0, end=100):
+ if rom == None or len(rom) <= 4:
+ load_rom()
+ run_main()
+
+ movements = list_movements_in_bank(bank)[start:end]
+
+ asm = Asm()
+ asm.insert_with_dependencies(movements)
+ asm.dump()
+ print "done dumping movements for bank $%.2x" % (bank)
+
def index(seq, f):
"""return the index of the first item in seq
where f(item) == True."""