Find Formation Palette Index (ATTACK.OUT)

From Final Fantasy Hacktics Wiki
(Redirected from 001c8598 - 001c8c04)
Jump to navigation Jump to search

< ATTACK.OUT Routines

# WORLD.BIN: Find Formation Palette Index
# REQUIRE.OUT: Find Formation Palette Index (REQUIRE.OUT)
001c8598: 27bdffb8 addiu r29,r29,0xffb8
001c859c: 3c040001 lui r4,0x0001
001c85a0: afbf0040 sw r31,0x0040(r29)
001c85a4: afb5003c sw r21,0x003c(r29)
001c85a8: afb40038 sw r20,0x0038(r29)
001c85ac: afb30034 sw r19,0x0034(r29)
001c85b0: afb20030 sw r18,0x0030(r29)
001c85b4: afb1002c sw r17,0x002c(r29)
001c85b8: 0c011105 jal 0x00044414
001c85bc: afb00028 sw r16,0x0028(r29)
001c85c0: 3c038016 lui r3,0x8016
001c85c4: 94635fda lhu r3,0x5fda(r3)
001c85c8: 00000000 nop
001c85cc: 10600012 beq r3,r0,0x001c8618
001c85d0: 00409021 addu r18,r2,r0
001c85d4: 34020002 ori r2,r0,0x0002
001c85d8: 14620006 bne r3,r2,0x001c85f4
001c85dc: 3404166b ori r4,r0,0x166b
001c85e0: 3c050001 lui r5,0x0001
001c85e4: 0c072009 jal 0x001c8024
001c85e8: 02403021 addu r6,r18,r0
001c85ec: 08072191 j 0x001c8644
001c85f0: 00000000 nop
001c85f4: 3c028004 lui r2,0x8004
001c85f8: 24424954 addiu r2,r2,0x4954
001c85fc: 3c018017 lui r1,0x8017
001c8600: ac223ca8 sw r2,0x3ca8(r1)
001c8604: 3c050001 lui r5,0x0001
001c8608: 0c0533ad jal 0x0014ceb4
001c860c: 02403021 addu r6,r18,r0
001c8610: 08072191 j 0x001c8644
001c8614: 00000000 nop
001c8618: 3c04801d lui r4,0x801d
001c861c: 24845db8 addiu r4,r4,0x5db8
001c8620: 0c009258 jal 0x00024960
001c8624: 02402821 addu r5,r18,r0
001c8628: 3c04801d lui r4,0x801d
001c862c: 24845dc0 addiu r4,r4,0x5dc0
001c8630: 34058000 ori r5,r0,0x8000
001c8634: 0c009258 jal 0x00024960
001c8638: 02452821 addu r5,r18,r5
001c863c: 0c0091b5 jal 0x000246d4
001c8640: 00002021 addu r4,r0,r0
001c8644: 3c04801d lui r4,0x801d
001c8648: 24845db8 addiu r4,r4,0x5db8
001c864c: 34058000 ori r5,r0,0x8000
001c8650: 0c00923f jal 0x000248fc
001c8654: 02452821 addu r5,r18,r5
001c8658: 3c038016 lui r3,0x8016
001c865c: 94635fda lhu r3,0x5fda(r3)
001c8660: 34020002 ori r2,r0,0x0002
001c8664: 14620005 bne r3,r2,0x001c867c
001c8668: 00000000 nop
001c866c: 0c0532a0 jal 0x0014ca80
001c8670: 00008821 addu r17,r0,r0
001c8674: 080721a3 j 0x001c868c
001c8678: 3c146666 lui r20,0x6666
001c867c: 0c0091b5 jal 0x000246d4
001c8680: 00002021 addu r4,r0,r0
001c8684: 00008821 addu r17,r0,r0
001c8688: 3c146666 lui r20,0x6666
001c868c: 36946667 ori r20,r20,0x6667
001c8690: 3c13801e lui r19,0x801e
001c8694: 2673d2d4 addiu r19,r19,0xd2d4
001c8698: 3c15801e lui r21,0x801e
001c869c: 26b5d5e4 addiu r21,r21,0xd5e4
001c86a0: 0c0166bc jal 0x00059af0
001c86a4: 02202021 addu r4,r17,r0
001c86a8: 00408021 addu r16,r2,r0
001c86ac: 92030000 lbu r3,0x0000(r16)
001c86b0: 00000000 nop
001c86b4: 2c620080 sltiu r2,r3,0x0080
001c86b8: 14400026 bne r2,r0,0x001c8754
001c86bc: 00602821 addu r5,r3,r0
001c86c0: 34020080 ori r2,r0,0x0080
001c86c4: 1462000a bne r3,r2,0x001c86f0
001c86c8: 34020081 ori r2,r0,0x0081
001c86cc: 92020002 lbu r2,0x0002(r16)
001c86d0: 00000000 nop
001c86d4: 2443ffb6 addiu r3,r2,0xffb6
001c86d8: 00032040 sll r4,r3,0x01
001c86dc: 3403005d ori r3,r0,0x005d
001c86e0: 14430014 bne r2,r3,0x001c8734
001c86e4: 24850060 addiu r5,r4,0x0060
001c86e8: 080721cd j 0x001c8734
001c86ec: 2485005e addiu r5,r4,0x005e
001c86f0: 1462000a bne r3,r2,0x001c871c
001c86f4: 00000000 nop
001c86f8: 92020002 lbu r2,0x0002(r16)
001c86fc: 00000000 nop
001c8700: 2443ffb6 addiu r3,r2,0xffb6
001c8704: 00032040 sll r4,r3,0x01
001c8708: 3403005d ori r3,r0,0x005d
001c870c: 14430009 bne r2,r3,0x001c8734
001c8710: 24850061 addiu r5,r4,0x0061
001c8714: 080721cd j 0x001c8734
001c8718: 2485005f addiu r5,r4,0x005f
001c871c: 92040002 lbu r4,0x0002(r16)
001c8720: 0c016a29 jal 0x0005a8a4
001c8724: 00000000 nop
001c8728: 3c01801e lui r1,0x801e
001c872c: ac22caa8 sw r2,-0x3558(r1)
001c8730: 9045002d lbu r5,0x002d(r2)
001c8734: 92030002 lbu r3,0x0002(r16)
001c8738: 3402005b ori r2,r0,0x005b
001c873c: 14620002 bne r3,r2,0x001c8748
001c8740: 3402005c ori r2,r0,0x005c
001c8744: 34050082 ori r5,r0,0x0082
001c8748: 14620003 bne r3,r2,0x001c8758
001c874c: 00051040 sll r2,r5,0x01
001c8750: 34050083 ori r5,r0,0x0083
001c8754: 00051040 sll r2,r5,0x01
001c8758: 92030000 lbu r3,0x0000(r16)
001c875c: 3c01801d lui r1,0x801d
001c8760: 00220821 addu r1,r1,r2
001c8764: 94255bb0 lhu r5,0x5bb0(r1)              # Load the index for the UNIT.BIN sprite.
001c8768: 14600002 bne r3,r0,0x001c8774
001c876c: 34020082 ori r2,r0,0x0082
001c8770: 00002821 addu r5,r0,r0
001c8774: 14620008 bne r3,r2,0x001c8798
001c8778: 00000000 nop
001c877c: 3c02801e lui r2,0x801e
001c8780: 8c42caa8 lw r2,-0x3558(r2)
001c8784: 00000000 nop
001c8788: 9042002e lbu r2,0x002e(r2)
001c878c: 00000000 nop
001c8790: 00021280 sll r2,r2,0x0a
001c8794: 00a22825 or r5,r5,r2
001c8798: 30a500ff andi r5,r5,0x00ff
001c879c: 34020018 ori r2,r0,0x0018
001c87a0: 14a20004 bne r5,r2,0x001c87b4
001c87a4: 28a2003f slti r2,r5,0x003f
001c87a8: 2410ffff addiu r16,r0,0xffff
001c87ac: 080721fb j 0x001c87ec
001c87b0: 3405004c ori r5,r0,0x004c
001c87b4: 14400006 bne r2,r0,0x001c87d0
001c87b8: 00000000 nop
001c87bc: 3c01801d lui r1,0x801d
001c87c0: 00250821 addu r1,r1,r5
001c87c4: 90255d65 lbu r5,0x5d65(r1)
001c87c8: 080721fb j 0x001c87ec
001c87cc: 00a08021 addu r16,r5,r0
001c87d0: 92020000 lbu r2,0x0000(r16)
001c87d4: 00000000 nop
001c87d8: 30420080 andi r2,r2,0x0080
001c87dc: 10400003 beq r2,r0,0x001c87ec
001c87e0: 00a08021 addu r16,r5,r0
001c87e4: 24a5ffff addiu r5,r5,0xffff
001c87e8: 00a08021 addu r16,r5,r0
001c87ec: 3c028888 lui r2,0x8888
001c87f0: 34428889 ori r2,r2,0x8889
001c87f4: 00a20018 mult r5,r2
001c87f8: 00051fc3 sra r3,r5,0x1f
001c87fc: 00001010 mfhi r2
001c8800: 00451021 addu r2,r2,r5
001c8804: 00021143 sra r2,r2,0x05
001c8808: 00434023 subu r8,r2,r3
001c880c: 00081100 sll r2,r8,0x04
001c8810: 00481023 subu r2,r2,r8
001c8814: 00021080 sll r2,r2,0x02
001c8818: 1500000c bne r8,r0,0x001c884c
001c881c: 00a22823 subu r5,r5,r2
001c8820: 00b40018 mult r5,r20
001c8824: 00051fc3 sra r3,r5,0x1f
001c8828: 00001010 mfhi r2
001c882c: 00021083 sra r2,r2,0x02
001c8830: 00433023 subu r6,r2,r3
001c8834: 00c01821 addu r3,r6,r0
001c8838: 00031080 sll r2,r3,0x02
001c883c: 00431021 addu r2,r2,r3
001c8840: 00021040 sll r2,r2,0x01
001c8844: 0807222a j 0x001c88a8
001c8848: 00a23023 subu r6,r5,r2
001c884c: 28a20008 slti r2,r5,0x0008
001c8850: 1040000b beq r2,r0,0x001c8880
001c8854: 00b40018 mult r5,r20
001c8858: 00051fc3 sra r3,r5,0x1f
001c885c: 00001010 mfhi r2
001c8860: 00021083 sra r2,r2,0x02
001c8864: 00433023 subu r6,r2,r3
001c8868: 00c01821 addu r3,r6,r0
001c886c: 00031080 sll r2,r3,0x02
001c8870: 00431021 addu r2,r2,r3
001c8874: 00021040 sll r2,r2,0x01
001c8878: 0807222a j 0x001c88a8
001c887c: 00a23023 subu r6,r5,r2
001c8880: 24a4fff8 addiu r4,r5,0xfff8
001c8884: 00940018 mult r4,r20
001c8888: 00041fc3 sra r3,r4,0x1f
001c888c: 00001010 mfhi r2
001c8890: 00021043 sra r2,r2,0x01
001c8894: 00433023 subu r6,r2,r3
001c8898: 00c01821 addu r3,r6,r0
001c889c: 00031080 sll r2,r3,0x02
001c88a0: 00431021 addu r2,r2,r3
001c88a4: 00823023 subu r6,r4,r2
001c88a8: 00603821 addu r7,r3,r0
001c88ac: 3404047f ori r4,r0,0x047f
001c88b0: 3c02801e lui r2,0x801e
001c88b4: 2442da63 addiu r2,r2,0xda63
001c88b8: a0400000 sb r0,0x0000(r2)
001c88bc: 2484ffff addiu r4,r4,0xffff
001c88c0: 0481fffd bgez r4,0x001c88b8
001c88c4: 2442ffff addiu r2,r2,0xffff
001c88c8: 34020001 ori r2,r0,0x0001
001c88cc: 15020043 bne r8,r2,0x001c89dc
001c88d0: 28a20008 slti r2,r5,0x0008
001c88d4: 14400042 bne r2,r0,0x001c89e0
001c88d8: 000823c0 sll r4,r8,0x0f
001c88dc: 34048000 ori r4,r0,0x8000
001c88e0: 00061840 sll r3,r6,0x01
001c88e4: 00661821 addu r3,r3,r6
001c88e8: 00031900 sll r3,r3,0x04
001c88ec: 00071040 sll r2,r7,0x01
001c88f0: 00471021 addu r2,r2,r7
001c88f4: 00021300 sll r2,r2,0x0c
001c88f8: 00621821 addu r3,r3,r2
001c88fc: 02340018 mult r17,r20
001c8900: 24632800 addiu r3,r3,0x2800
001c8904: 00031843 sra r3,r3,0x01
001c8908: 00641021 addu r2,r3,r4
001c890c: 00002821 addu r5,r0,r0
001c8910: 02424821 addu r9,r18,r2
001c8914: 00004021 addu r8,r0,r0
001c8918: 3402000c ori r2,r0,0x000c
001c891c: a6620004 sh r2,0x0004(r19)
001c8920: 34020030 ori r2,r0,0x0030
001c8924: a6620006 sh r2,0x0006(r19)
001c8928: 001117c3 sra r2,r17,0x1f
001c892c: 00002010 mfhi r4
001c8930: 00042043 sra r4,r4,0x01
001c8934: 00822023 subu r4,r4,r2
001c8938: 00041880 sll r3,r4,0x02
001c893c: 00641821 addu r3,r3,r4
001c8940: 02231823 subu r3,r17,r3
001c8944: 00031040 sll r2,r3,0x01
001c8948: 00431021 addu r2,r2,r3
001c894c: 00021080 sll r2,r2,0x02
001c8950: 24420180 addiu r2,r2,0x0180
001c8954: a6620000 sh r2,0x0000(r19)
001c8958: 00041040 sll r2,r4,0x01
001c895c: 00441021 addu r2,r2,r4
001c8960: 00021100 sll r2,r2,0x04
001c8964: a6620002 sh r2,0x0002(r19)
001c8968: 00002021 addu r4,r0,r0
001c896c: 01003821 addu r7,r8,r0
001c8970: 000531c0 sll r6,r5,0x07
001c8974: 00e41821 addu r3,r7,r4
001c8978: 01241021 addu r2,r9,r4
001c897c: 24840001 addiu r4,r4,0x0001
001c8980: 00c21021 addu r2,r6,r2
001c8984: 90420000 lbu r2,0x0000(r2)
001c8988: 00751821 addu r3,r3,r21
001c898c: a0620000 sb r2,0x0000(r3)
001c8990: 28820018 slti r2,r4,0x0018
001c8994: 1440fff7 bne r2,r0,0x001c8974
001c8998: 00000000 nop
001c899c: 24a50001 addiu r5,r5,0x0001
001c89a0: 28a20030 slti r2,r5,0x0030
001c89a4: 1440fff0 bne r2,r0,0x001c8968
001c89a8: 25080018 addiu r8,r8,0x0018
001c89ac: 3c04801e lui r4,0x801e
001c89b0: 2484d2d4 addiu r4,r4,0xd2d4
001c89b4: 3c05801e lui r5,0x801e
001c89b8: 24a5d5e4 addiu r5,r5,0xd5e4
001c89bc: 0c00923f jal 0x000248fc
001c89c0: 00000000 nop
001c89c4: 34020001 ori r2,r0,0x0001
001c89c8: 3c01801d lui r1,0x801d
001c89cc: 00310821 addu r1,r1,r17
001c89d0: a022d014 sb r2,-0x2fec(r1)
001c89d4: 080722b4 j 0x001c8ad0
001c89d8: 02002821 addu r5,r16,r0
001c89dc: 000823c0 sll r4,r8,0x0f
001c89e0: 00061840 sll r3,r6,0x01
001c89e4: 00661821 addu r3,r3,r6
001c89e8: 000318c0 sll r3,r3,0x03
001c89ec: 00071080 sll r2,r7,0x02
001c89f0: 00471021 addu r2,r2,r7
001c89f4: 000212c0 sll r2,r2,0x0b
001c89f8: 02340018 mult r17,r20
001c89fc: 00621821 addu r3,r3,r2
001c8a00: 00031843 sra r3,r3,0x01
001c8a04: 00831021 addu r2,r4,r3
001c8a08: 34050008 ori r5,r0,0x0008
001c8a0c: 02424821 addu r9,r18,r2
001c8a10: 340800c0 ori r8,r0,0x00c0
001c8a14: 3402000c ori r2,r0,0x000c
001c8a18: a6620004 sh r2,0x0004(r19)
001c8a1c: 34020030 ori r2,r0,0x0030
001c8a20: a6620006 sh r2,0x0006(r19)
001c8a24: 001117c3 sra r2,r17,0x1f
001c8a28: 00002010 mfhi r4
001c8a2c: 00042043 sra r4,r4,0x01
001c8a30: 00822023 subu r4,r4,r2
001c8a34: 00041880 sll r3,r4,0x02
001c8a38: 00641821 addu r3,r3,r4
001c8a3c: 02231823 subu r3,r17,r3
001c8a40: 00031040 sll r2,r3,0x01
001c8a44: 00431021 addu r2,r2,r3
001c8a48: 00021080 sll r2,r2,0x02
001c8a4c: 24420180 addiu r2,r2,0x0180
001c8a50: a6620000 sh r2,0x0000(r19)
001c8a54: 00041040 sll r2,r4,0x01
001c8a58: 00441021 addu r2,r2,r4
001c8a5c: 00021100 sll r2,r2,0x04
001c8a60: a6620002 sh r2,0x0002(r19)
001c8a64: 34040006 ori r4,r0,0x0006
001c8a68: 01003821 addu r7,r8,r0
001c8a6c: 000531c0 sll r6,r5,0x07
001c8a70: 00e41821 addu r3,r7,r4
001c8a74: 00891021 addu r2,r4,r9
001c8a78: 24840001 addiu r4,r4,0x0001
001c8a7c: 00461021 addu r2,r2,r6
001c8a80: 9042fbfa lbu r2,-0x0406(r2)
001c8a84: 00751821 addu r3,r3,r21
001c8a88: a0620000 sb r2,0x0000(r3)
001c8a8c: 28820012 slti r2,r4,0x0012
001c8a90: 1440fff7 bne r2,r0,0x001c8a70
001c8a94: 00000000 nop
001c8a98: 24a50001 addiu r5,r5,0x0001
001c8a9c: 28a20030 slti r2,r5,0x0030
001c8aa0: 1440fff0 bne r2,r0,0x001c8a64
001c8aa4: 25080018 addiu r8,r8,0x0018
001c8aa8: 3c04801e lui r4,0x801e
001c8aac: 2484d2d4 addiu r4,r4,0xd2d4
001c8ab0: 3c05801e lui r5,0x801e
001c8ab4: 24a5d5e4 addiu r5,r5,0xd5e4
001c8ab8: 0c00923f jal 0x000248fc
001c8abc: 00000000 nop
001c8ac0: 3c01801d lui r1,0x801d
001c8ac4: 00310821 addu r1,r1,r17
001c8ac8: a020d014 sb r0,-0x2fec(r1)
001c8acc: 02002821 addu r5,r16,r0
001c8ad0: 2402ffff addiu r2,r0,0xffff
001c8ad4: 14a20003 bne r5,r2,0x001c8ae4
001c8ad8: 00000000 nop
001c8adc: 080722c3 j 0x001c8b0c
001c8ae0: 3405007a ori r5,r0,0x007a
001c8ae4: 28a2003e slti r2,r5,0x003e
001c8ae8: 14400008 bne r2,r0,0x001c8b0c
001c8aec: 24a4ffc2 addiu r4,r5,0xffc2
001c8af0: 3c02801e lui r2,0x801e
001c8af4: 8c42caa8 lw r2,-0x3558(r2)
001c8af8: 00041840 sll r3,r4,0x01
001c8afc: 9042002e lbu r2,0x002e(r2)
001c8b00: 00641821 addu r3,r3,r4
001c8b04: 2442003e addiu r2,r2,0x003e
001c8b08: 00622821 addu r5,r3,r2
001c8b0c: 04a10002 bgez r5,0x001c8b18
001c8b10: 00a01021 addu r2,r5,r0
001c8b14: 24a20003 addiu r2,r5,0x0003
001c8b18: 00023083 sra r6,r2,0x02
001c8b1c: 00c01821 addu r3,r6,r0
001c8b20: 00031080 sll r2,r3,0x02
001c8b24: 00a23023 subu r6,r5,r2
001c8b28: 02203821 addu r7,r17,r0
001c8b2c: 00031200 sll r2,r3,0x08
001c8b30: 00061980 sll r3,r6,0x06
001c8b34: 00431021 addu r2,r2,r3
001c8b38: 00021043 sra r2,r2,0x01
001c8b3c: 3403f000 ori r3,r0,0xf000
001c8b40: 3c04801e lui r4,0x801e
001c8b44: 2484d2dc addiu r4,r4,0xd2dc
001c8b48: 06210002 bgez r17,0x001c8b54
001c8b4c: 00431021 addu r2,r2,r3
001c8b50: 26270003 addiu r7,r17,0x0003
001c8b54: 02422821 addu r5,r18,r2
001c8b58: 00071883 sra r3,r7,0x02
001c8b5c: 00031080 sll r2,r3,0x02
001c8b60: 02221023 subu r2,r17,r2
001c8b64: 00021100 sll r2,r2,0x04
001c8b68: 24420180 addiu r2,r2,0x0180
001c8b6c: 246300e0 addiu r3,r3,0x00e0
001c8b70: a4820000 sh r2,0x0000(r4)
001c8b74: 34020010 ori r2,r0,0x0010
001c8b78: 3c01801e lui r1,0x801e
001c8b7c: a422d2e0 sh r2,-0x2d20(r1)
001c8b80: 34020001 ori r2,r0,0x0001
001c8b84: 3c01801e lui r1,0x801e
001c8b88: a423d2de sh r3,-0x2d22(r1)
001c8b8c: 3c01801e lui r1,0x801e
001c8b90: a422d2e2 sh r2,-0x2d1e(r1)
001c8b94: 0c00923f jal 0x000248fc
001c8b98: 00000000 nop
001c8b9c: 3c038016 lui r3,0x8016
001c8ba0: 94635fda lhu r3,0x5fda(r3)
001c8ba4: 34020002 ori r2,r0,0x0002
001c8ba8: 14620005 bne r3,r2,0x001c8bc0
001c8bac: 00000000 nop
001c8bb0: 0c0532a0 jal 0x0014ca80
001c8bb4: 26310001 addiu r17,r17,0x0001
001c8bb8: 080722f4 j 0x001c8bd0
001c8bbc: 2a220010 slti r2,r17,0x0010
001c8bc0: 0c0091b5 jal 0x000246d4
001c8bc4: 00002021 addu r4,r0,r0
001c8bc8: 26310001 addiu r17,r17,0x0001
001c8bcc: 2a220010 slti r2,r17,0x0010
001c8bd0: 1440feb3 bne r2,r0,0x001c86a0
001c8bd4: 00000000 nop
001c8bd8: 0c011273 jal 0x000449cc
001c8bdc: 02402021 addu r4,r18,r0
001c8be0: 8fbf0040 lw r31,0x0040(r29)
001c8be4: 8fb5003c lw r21,0x003c(r29)
001c8be8: 8fb40038 lw r20,0x0038(r29)
001c8bec: 8fb30034 lw r19,0x0034(r29)
001c8bf0: 8fb20030 lw r18,0x0030(r29)
001c8bf4: 8fb1002c lw r17,0x002c(r29)
001c8bf8: 8fb00028 lw r16,0x0028(r29)
001c8bfc: 27bd0048 addiu r29,r29,0x0048
001c8c00: 03e00008 jr r31
001c8c04: 00000000 nop