summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan Bishop <kanzure@gmail.com>2012-05-11 13:05:02 -0500
committerBryan Bishop <kanzure@gmail.com>2012-05-11 13:05:02 -0500
commit00bf81347b144fe2bf7ae93914ea51ac63d145a6 (patch)
tree78e32e73d3f37670d27e9bfc2570c25740426b39
parent7076a4d6e5fd45a0a14445bd1998af3722dd235a (diff)
fix TextScript bug - to_asm should not modify self.size
original-commit-id: 55c174d3424cf314cfb0fc278de8b0d12e372329
-rw-r--r--crystal.py21
1 files changed, 15 insertions, 6 deletions
diff --git a/crystal.py b/crystal.py
index a26cd1c..bcff6c2 100644
--- a/crystal.py
+++ b/crystal.py
@@ -483,17 +483,28 @@ class TextScript:
end = cls.end
# skip past the command's parameter bytes to go to the next command
- current_address += cls.size
+ #current_address += cls.size
+ current_address = cls.last_address
# last byte belonging to script is last byte of last command,
# or the last byte of the last command's last parameter
# (actually i think this might be the next byte after??)
self.last_address = current_address
+ if self.debug:
+ print "cls.address is: " + hex(cls.address)
+ print "cls.size is: " + hex(cls.size)
+ print "cls.last_address is: " + hex(cls.last_address)
+ print "self.last_address is: " + hex(self.last_address)
+
+ assert self.last_address == (cls.address + cls.size), "the last address should equal the last command's (address + size)"
+ assert self.last_address == cls.last_address, "the last address of the TextScript should be the last_address of its last command"
+
# just some debugging..
- last_address = self.last_address
- print "TextScript last_address == " + hex(last_address)
- #assert last_address != 0x5db06, "TextScript.parse somehow has a text with a last_address of 0x5db06 instead of 0x5db07"
+ if self.debug:
+ last_address = self.last_address
+ print "TextScript last_address == " + hex(last_address)
+ #assert last_address != 0x5db06, "TextScript.parse somehow has a text with a last_address of 0x5db06 instead of 0x5db07"
# store the script in the global table/map thing
script_parse_table[start_address:current_address] = self
@@ -2311,8 +2322,6 @@ class MainText(TextCommand):
if output[-1] == "\n":
output = output[:-1]
- self.size = len(self.bytes)
-
return output
class WriteTextFromRAM(TextCommand):