debugging statements

This commit is contained in:
Bryan Bishop 2012-04-15 12:26:46 -05:00
parent 00ab26a8c4
commit cbd8f0925a

View File

@ -5298,6 +5298,7 @@ def parse_signposts(address, signpost_count, bank=None, map_group=None, map_id=N
class MapHeader: class MapHeader:
base_label = "MapHeader_" base_label = "MapHeader_"
def __init__(self, address, map_group=None, map_id=None, debug=True, label=None, bank=0x25): def __init__(self, address, map_group=None, map_id=None, debug=True, label=None, bank=0x25):
print "creating a MapHeader at "+hex(address)+" map_group="+str(map_group)+" map_id="+str(map_id)
self.address = address self.address = address
self.map_group = map_group self.map_group = map_group
self.map_id = map_id self.map_id = map_id
@ -5312,6 +5313,7 @@ class MapHeader:
self.parse() self.parse()
def parse(self): def parse(self):
address = self.address address = self.address
print "parsing a MapHeader at " + hex(address)
self.bank = HexByte(address=address) self.bank = HexByte(address=address)
self.tileset = HexByte(address=address+1) self.tileset = HexByte(address=address+1)
self.permission = DecimalParam(address=address+2) self.permission = DecimalParam(address=address+2)
@ -5339,6 +5341,7 @@ def parse_map_header_at(address, map_group=None, map_id=None, debug=True):
class SecondMapHeader: class SecondMapHeader:
base_label = "SecondMapHeader_" base_label = "SecondMapHeader_"
def __init__(self, address, map_group=None, map_id=None, debug=True, bank=None, label=None): def __init__(self, address, map_group=None, map_id=None, debug=True, bank=None, label=None):
print "creating a SecondMapHeader at " + hex(address)
self.address = address self.address = address
self.map_group = map_group self.map_group = map_group
self.map_id = map_id self.map_id = map_id
@ -5459,6 +5462,7 @@ class MapBlockData:
class MapEventHeader: class MapEventHeader:
base_label = "MapEventHeader_" base_label = "MapEventHeader_"
def __init__(self, address, map_group=None, map_id=None, debug=True, bank=None, label=None): def __init__(self, address, map_group=None, map_id=None, debug=True, bank=None, label=None):
print "making a MapEventHeader at "+hex(address)+" map_group="+str(map_group)+" map_id="+str(map_id)
self.address = address self.address = address
self.map_group = map_group self.map_group = map_group
self.map_id = map_id self.map_id = map_id
@ -5600,6 +5604,7 @@ class MapScriptHeader:
""" """
base_label = "MapScriptHeader_" base_label = "MapScriptHeader_"
def __init__(self, address, map_group=None, map_id=None, debug=True, bank=None, label=None): def __init__(self, address, map_group=None, map_id=None, debug=True, bank=None, label=None):
print "creating a MapScriptHeader at " + hex(address) + " map_group="+str(map_group)+" map_id="+str(map_id)
self.address = address self.address = address
self.map_group = map_group self.map_group = map_group
self.map_id = map_id self.map_id = map_id
@ -5623,7 +5628,7 @@ class MapScriptHeader:
groups = grouper(rom_interval(address+1, self.trigger_count * ptr_line_size, strings=False), count=ptr_line_size) groups = grouper(rom_interval(address+1, self.trigger_count * ptr_line_size, strings=False), count=ptr_line_size)
current_address = address current_address = address
for (index, trigger_bytes) in enumerate(groups): for (index, trigger_bytes) in enumerate(groups):
print "parsing a trigger header..." print "parsing a map trigger script at "+hex(current_address)+" map_group="+str(map_group)+" map_id="+str(map_id)
script = ScriptPointerLabelParam(address=current_address, map_group=map_group, map_id=map_id, debug=debug) script = ScriptPointerLabelParam(address=current_address, map_group=map_group, map_id=map_id, debug=debug)
self.triggers.append(script) self.triggers.append(script)
current_address += ptr_line_size current_address += ptr_line_size
@ -5631,13 +5636,16 @@ class MapScriptHeader:
#[[Number2 of pointers] Number2 * [hook number][2byte pointer to script]] #[[Number2 of pointers] Number2 * [hook number][2byte pointer to script]]
callback_ptr_line_size = 3 callback_ptr_line_size = 3
self.callback_count = DecimalParam(address=current_address) self.callback_count = DecimalParam(address=current_address)
current_address += 1
self.callbacks = [] self.callbacks = []
for index in range(self.callback_count.byte): for index in range(self.callback_count.byte):
print "parsing a callback script at "+hex(current_address)+" map_group="+str(map_group)+" map_id="+str(map_id)
hook_byte = HexByte(address=current_address) hook_byte = HexByte(address=current_address)
callback = ScriptPointerLabelParam(address=current_address+1, map_group=map_group, map_id=map_id, debug=debug) callback = ScriptPointerLabelParam(address=current_address+1, map_group=map_group, map_id=map_id, debug=debug)
self.callbacks.append({"hook": hook_byte, "callback": callback}) self.callbacks.append({"hook": hook_byte, "callback": callback})
current_address += 3 #i think? current_address += 3 #i think?
self.last_address = current_address self.last_address = current_address
print "done parsing a MapScriptHeader map_group="+str(map_group)+" map_id="+str(map_id)
return True return True
def to_asm(self): def to_asm(self):
output = "" output = ""