fix TextScript bug - to_asm should not modify self.size

This commit is contained in:
Bryan Bishop 2012-05-11 13:05:02 -05:00
parent e7913e7a90
commit 55c174d342

View File

@ -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):