update automatic main.asm insertion

This updates the automatic parsing of main.asm to catch cases of INCBINs
pulling in files that end in .asm, .lz, .1bpp, and .2bpp. This is
necessary because otherwise the parser tries to figure out the start and
end addresses expressed on the INCBIN line, details not present on these
types of lines in the asm.

Asm and Asm.insert_all are now back in working condition.
This commit is contained in:
Bryan Bishop 2013-02-27 21:38:53 -06:00
parent 381d3e76b7
commit 0e2ab04353

View File

@ -6752,7 +6752,7 @@ class Asm:
asm_list = AsmList(asm) asm_list = AsmList(asm)
bank = 0 bank = 0
for line in asm_list: for line in asm_list:
if line[0:6] == "INCBIN" or line[1:6] == "INCBIN": if (line[0:6] == "INCBIN" or line[1:6] == "INCBIN") and not any([contaminant+"\"" in line for contaminant in [".2bpp", ".1bpp", ".asm", ".lz"]]):
thing = Incbin(line, bank=bank) thing = Incbin(line, bank=bank)
elif line[0:7] == "SECTION": elif line[0:7] == "SECTION":
thing = AsmSection(line) thing = AsmSection(line)
@ -6817,11 +6817,13 @@ class Asm:
# check if the object is already inserted # check if the object is already inserted
if new_object in self.parts: if new_object in self.parts:
print "object was previously inserted ("+str(new_object)+")" print "object was previously inserted ("+str(new_object)+"; " + hex(new_object.address) + ")"
return return
# check by label # check by label
if self.is_label_name_in_file(new_object.label.name): other_obj = self.is_label_name_in_file(new_object.label.name)
print "object was previously inserted ("+str(new_object)+") by label: "+new_object.label.name if other_obj:
other_obj = other_obj.object
print "object was previously inserted ("+new_object.label.name+" at "+hex(new_object.address)+") by "+other_obj.label.name+" at "+hex(other_obj.address)
return return
# check by address # check by address
#if self.does_address_have_label(new_object.address): #if self.does_address_have_label(new_object.address):