def dump_battle_anims(table_address=0xc906f, num_anims=278, macros=battle_animation_classes):
	"""
	Dump each battle animation from a pointer table.
	"""

	asms = []

	asms += [(table_address, 'BattleAnimations: ; %x' % table_address, table_address)]

	address = table_address
	bank = address / 0x4000

	for i in xrange(num_anims):
		pointer_address = address
		anim_address = rom[pointer_address] + rom[pointer_address + 1] * 0x100
		anim_address = get_global_address(anim_address, bank)
		base_label = battle_anim_label(i)
		address += 2

		# anim pointer
		asms += [(pointer_address, '\tdw %s' % base_label, address)]

		# anim script
		anim = BattleAnim(
			address=anim_address,
			base_label=base_label,
			macros=macros
		)
		asms += anim.output + anim.labels

	asms += [(address, '; %x\n' % address, address)]

	# jp sonicboom
	anim = BattleAnim(
		address=0xc9c00,
		base_label='BattleAnim_Sonicboom_JP',
		macros=macros
	)
	asms += anim.output + anim.labels

	asms = sort_asms(asms)
	return asms
def dump_battle_anims(table_address=0xc906f,
                      num_anims=278,
                      macros=battle_animation_classes):
    """
	Dump each battle animation from a pointer table.
	"""

    asms = []

    asms += [(table_address, 'BattleAnimations: ; %x' % table_address,
              table_address)]

    address = table_address
    bank = address / 0x4000

    for i in xrange(num_anims):
        pointer_address = address
        anim_address = rom[pointer_address] + rom[pointer_address + 1] * 0x100
        anim_address = get_global_address(anim_address, bank)
        base_label = battle_anim_label(i)
        address += 2

        # anim pointer
        asms += [(pointer_address, '\tdw %s' % base_label, address)]

        # anim script
        anim = BattleAnim(address=anim_address,
                          base_label=base_label,
                          macros=macros)
        asms += anim.output + anim.labels

    asms += [(address, '; %x\n' % address, address)]

    # jp sonicboom
    anim = BattleAnim(address=0xc9c00,
                      base_label='BattleAnim_Sonicboom_JP',
                      macros=macros)
    asms += anim.output + anim.labels

    asms = sort_asms(asms)
    return asms
	def to_asm(self):
		output = sort_asms(self.output + self.labels)
		text = ''
		for (address, asm, last_address) in output:
			text += asm + '\n'
		return text
 def to_asm(self):
     output = sort_asms(self.output + self.labels)
     text = ''
     for (address, asm, last_address) in output:
         text += asm + '\n'
     return text