def to_asm(self): output = sort_asms(self.output + self.labels) text = '' for i, (address, asm, last_address) in enumerate(output): if line_has_label(asm): # dont print labels for empty chunks for (address_, asm_, last_address_) in output[i:]: if not line_has_label(asm_): text += '\n' + asm + '\n' break else: text += asm + '\n' text += '@ %x' % (last_address) + '\n' return text
def to_asm(self): output = sort_asms(self.output + self.labels) text = "" for i, (address, asm, last_address) in enumerate(output): if line_has_label(asm): # dont print labels for empty chunks for (address_, asm_, last_address_) in output[i:]: if not line_has_label(asm_): text += "\n" + asm + "\n" break else: text += asm + "\n" text += "; %x" % (last_address) + "\n" return text
def asm_sort(asm_def): """ Sort key for asm lists. Usage: list.sort(key=asm_sort) sorted(list, key=asm_sort) """ address, asm, last_address = asm_def return (address, last_address, not is_comment(asm), not line_has_label(asm), asm)