Difference between revisions of "Load ability data for skillset"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
 
(6 intermediate revisions by 5 users not shown)
Line 1: Line 1:
 
+
  '''BATTLE.BIN''' - Able_to_move/act_checks_(Menu%3F)
  Load ability data for skillset (MP, CT, Turns, req. sword booleans)
+
  ---------------------------------------------------------------------------------------
  001817c0: 27bdfed0 addiu r29,r29,0xfed0
+
  Parameter : r4 = Unit Battle ID
001817c4: afa400b0 sw r4,0x00b0(r29)
+
            r5 = Skillset ID
001817c8: 8fa400b0 lw r4,0x00b0(r29)              unit data?
+
            r6 = Pointer to output list of Ability ID
001817cc: afb40118 sw r20,0x0118(r29)
+
            r7 = Pointer to output list of Ability MP cost
001817d0: 8fb40140 lw r20,0x0140(r29)            0x10 stack address
+
            Previous routine Stack Pointer is used to pass other pointers
001817d4: afb20110 sw r18,0x0110(r29)
+
                Stack 0x10 - Pointer to output list of Ability CT
  001817d8: 8fb20148 lw r18,0x0148(r29)            0x18 stack address
+
                Stack 0x14 - Unused pointer ?
001817dc: afb1010c sw r17,0x010c(r29)
+
                Stack 0x18 - Pointer to output list of Ability Silence/Reflect flags
001817e0: 8fb1014c lw r17,0x014c(r29)            0x1c stack address
+
                Stack 0x1c - Pointer to output list of Nb of Turns unit resolution
001817e4: afbe0128 sw r30,0x0128(r29)
+
   
001817e8: 0000f021 addu r30,r0,r0
+
  Returns : r2 Nb of known and usable Abilities in skillset
001817ec: afbf012c sw r31,0x012c(r29)
+
   
001817f0: afb70124 sw r23,0x0124(r29)
+
  This Routine will : - check known abilities in skillset,  
  001817f4: afb60120 sw r22,0x0120(r29)
+
                    - check they can be used (sword - matera blade- Frog).
  001817f8: afb5011c sw r21,0x011c(r29)
+
                    - Set their CT (check short charge or non charge)
  001817fc: afb30114 sw r19,0x0114(r29)
+
                    - Set their MP cost (checking half MP)
  00181800: afb00108 sw r16,0x0108(r29)
+
                    - Fill the lists
00181804: afa600c0 sw r6,0x00c0(r29)             stack address (0x20)
+
  ---------------------------------------------------------------------------------------
  00181808: afa000e0 sw r0,0x00e0(r29)
+
  001817c0: 27bdfed0 addiu r29,r29,-0x0130    |
0018180c: afa000e8 sw r0,0x00e8(r29)
+
001817c4: afa400b0 sw r4,0x00b0(r29)       |
00181810: afa000f0 sw r0,0x00f0(r29)
+
  001817c8: 8fa400b0 lw r4,0x00b0(r29)       |{{f/adr|Unit Battle ID}}
00181814: afa000f8 sw r0,0x00f8(r29)
+
  001817cc: afb40118 sw r20,0x0118(r29)       |
00181818: afa00100 sw r0,0x0100(r29)
+
  001817d0: 8fb40140 lw r20,0x0140(r29)      |{{f/adr|Pointer to CT List }}
  0018181c: afa700c8 sw r7,0x00c8(r29)             Stack address (0x48)
+
  001817d4: afb20110 sw r18,0x0110(r29)      |
  00181820: 0c060435 jal 0x 001810d4 load unit data (r2)
+
  001817d8: 8fb20148 lw r18,0x0148(r29)      |{{f/adr|Pointer to Flags List}} {{f/std| Silence Reflect Performing}}
  00181824: a3a500b8 sb r5,0x00b8(r29) store primary skillset
+
  001817dc: afb1010c sw r17,0x010c(r29)       |
  00181828: 00408021 addu r16,r2,r0
+
  001817e0: 8fb1014c lw r17,0x014c(r29)      |{{f/adr|Pointer to Turns List}}
  0018182c: 120000c3 beq r16,r0,0x 00181b3c
+
  001817e4: afbe0128 sw r30,0x0128(r29)      |
  00181830: 00001021 addu r2,r0,r0
+
  001817e8: 0000f021 addu r30,r0,r0           |{{f/std|Initialize Nb of Abilities}}
  00181834: 9202005a lbu r2,0x005a(r16) load statii
+
  001817ec: afbf012c sw r31,0x012c(r29)       |
  00181838: 00000000 nop
+
  001817f0: afb70124 sw r23,0x0124(r29)       |
  0018183c: 30420002 andi r2,r2,0x0002
+
  001817f4: afb60120 sw r22,0x0120(r29)      |
  00181840: 10400003 beq r2,r0,0x 00181850 branch if not frog
+
  001817f8: afb5011c sw r21,0x011c(r29)      |
00181844: 00000000 nop
+
  001817fc: afb30114 sw r19,0x0114(r29)      |
00181848: 34090001 ori r9,r0,0x0001
+
  00181800: afb00108 sw r16,0x0108(r29)      |
  0018184c: afa90100 sw r9,0x0100(r29)                 frog flag
+
  00181804: afa600c0 sw r6,0x00c0(r29)        |{{f/store|Store Pointer to Ability ID list}}
  00181850: 92020090 lbu r2,0x0090(r16) load support 2
+
  00181808: afa000e0 sw r0,0x00e0(r29)       |{{f/store|Initialize Materia Blade flag}}
  00181854: 00000000 nop
+
  0018180c: afa000e8 sw r0,0x00e8(r29)       |{{f/store|Initialize Sword flag}}
  00181858: 30420080 andi r2,r2,0x0080
+
  00181810: afa000f0 sw r0,0x00f0(r29)        |{{f/store|Initialize Charge Mod}}
  0018185c: 10400003 beq r2,r0,0x 0018186c branch if not half of MP
+
  00181814: afa000f8 sw r0,0x00f8(r29)        |{{f/store|Initialize Half MP flag}}
  00181860: 00000000 nop
+
  00181818: afa00100 sw r0,0x0100(r29)        |{{f/store|Initialize Frog Flag}}
  00181864: 34080001 ori r8,r0,0x0001
+
  0018181c: afa700c8 sw r7,0x00c8(r29)       |{{f/store|Store Pointer to MP cost}}
  00181868: afa800f8 sw r8,0x00f8(r29)                 half mp flag
+
  00181820: 0c060435 jal 0x801810d4          |{{f/jal|Get_Existent_Battle_Unit_Pointer|Get_Existent_Battle_Unit_Pointer}} {{f/std|<nowiki>returns r2 = Unit data pointer (r4 ID)</nowiki>}}
  0018186c: 92030092 lbu r3,0x0092(r16) load support 4
+
  00181824: a3a500b8 sb r5,0x00b8(r29)        |{{f/store|Store Skillset ID}}
  00181870: 00000000 nop
+
  00181828: 00408021 addu r16,r2,r0           |{{f/adr|Pointer to Unit battle data}}
  00181874: 30620004 andi r2,r3,0x0004
+
  0018182c: 120000c3 beq r16,r0,0x80181b3c    {{f/Cond|If Pointer is invalid : }} {{f/loc| Exit and returns 0x00}}
  00181878: 10400003 beq r2,r0,0x 00181888 branch if not non-charge
+
  00181830: 00001021 addu r2,r0,r0               |{{f/std|}}
  0018187c: 34090002 ori r9,r0,0x0002
+
  00181834: 9202005a lbu r2,0x005a(r16)       |{{f/load|Unit Current Status 3}}
00181880: 08060626 j 0x 00181898
+
  00181838: 00000000 nop                     |
00181884: afa900f0 sw r9,0x00f0(r29)                 non charge flag
+
  0018183c: 30420002 andi r2,r2,0x0002        |
  00181888: 30620008 andi r2,r3,0x0008
+
  00181840: 10400003 beq r2,r0,0x80181850    {{f/Cond|If Unit has [Frog]}}
  0018188c: 10400002 beq r2,r0,0x 00181898 branch if not short charge
+
  00181844: 00000000 nop                          |{{f/std|}}
  00181890: 34080001 ori r8,r0,0x0001
+
  00181848: 34090001 ori r9,r0,0x0001             |{{f/std|}}
  00181894: afa800f0 sw r8,0x00f0(r29)                short charge flag
+
  0018184c: afa90100 sw r9,0x0100(r29)           |{{f/store|Enable Frog flag}}
00181898: 27a40010 addiu r4,r29,0x0010
+
  00181850: 92020090 lbu r2,0x0090(r16)      |{{f/load|Unit Support 2}}
  0018189c: 0c060dc3 jal 0x0018370c Calculate AT list
+
  00181854: 00000000 nop                     |
001818a0: 00002821 addu r5,r0,r0
+
  00181858: 30420080 andi r2,r2,0x0080        |
  001818a4: 92030184 lbu r3,0x0184(r16) load equipped flags
+
  0018185c: 10400003 beq r2,r0,0x8018186c    {{f/Cond|If Unit uses [Half of MP]}}
  001818a8: 00000000 nop
+
  00181860: 00000000 nop                         |{{f/std|}}
  001818ac: 30620004 andi r2,r3,0x0004
+
  00181864: 34080001 ori r8,r0,0x0001            |{{f/std|}}
  001818b0: 10400003 beq r2,r0,0x 001818c0 branch if materia blade not equipped
+
  00181868: afa800f8 sw r8,0x00f8(r29)            |{{f/store|Enable half of MP flag}}
  001818b4: 30620008 andi r2,r3,0x0008
+
  0018186c: 92030092 lbu r3,0x0092(r16)       |{{f/load|Unit Support 4}}
  001818b8: 34090001 ori r9,r0,0x0001
+
  00181870: 00000000 nop                     |
  001818bc: afa900e0 sw r9,0x00e0(r29)                 materia blade flag
+
  00181874: 30620004 andi r2,r3,0x0004        |
  001818c0: 10400003 beq r2,r0,0x 001818d0 branch if sword not equipped
+
  00181878: 10400003 beq r2,r0,0x80181888    {{f/Cond|If Unit uses [Non-Charge]}}
  001818c4: 00000000 nop
+
  0018187c: 34090002 ori r9,r0,0x0002            |{{f/std|}}
  001818c8: 34080001 ori r8,r0,0x0001
+
  00181880: 08060626 j 0x80181898                {{f/jump|Avoid Short Charge}}
  001818cc: afa800e8 sw r8,0x00e8(r29)                sword flag
+
  00181884: afa900f0 sw r9,0x00f0(r29)           |{{f/store|<nowiki>Store Charge Mod = 0x02</nowiki>}}
  001818d0: 92020006 lbu r2,0x0006(r16) load gender
+
                                            '''Else - No non-charge'''
001818d4: 00000000 nop
+
  00181888: 30620008 andi r2,r3,0x0008        |{{f/std|}}
  001818d8: 30420020 andi r2,r2,0x0020
+
  0018188c: 10400002 beq r2,r0,0x80181898    {{f/Cond|If Unit uses [Short-Charge]}}
  001818dc: 14400016 bne r2,r0,0x 00181938 branch if not human
+
  00181890: 34080001 ori r8,r0,0x0001            |{{f/std|}}
  001818e0: 00000000 nop
+
00181894: afa800f0 sw r8,0x00f0(r29)           |{{f/store|<nowiki>Store Charge Mod = 0x01</nowiki>}}
001818e4: 93a900b8 lbu r9,0x00b8(r29) load primary skillset
+
  00181898: 27a40010 addiu r4,r29,0x0010      |{{f/std|Send Pointer}}
  001818e8: 00000000 nop
+
  0018189c: 0c060dc3 jal 0x8018370c          |{{f/jal|Calculate_AT_List|Calculate_AT_List}} {{f/std|Store AT list on Pointer}}
  001818ec: 2522fffb addiu r2,r9,0xfffb primary skillset - 5
+
  001818a0: 00002821 addu r5,r0,r0           |
  001818f0: 304200ff andi r2,r2,0x00ff
+
  001818a4: 92030184 lbu r3,0x0184(r16)       |{{f/load|Unit Equipped flags}}
  001818f4: 2c420013 sltiu r2,r2,0x0013
+
  001818a8: 00000000 nop                     |
  001818f8: 10400004 beq r2,r0,0x 0018190c branch if not a generic skillset
+
  001818ac: 30620004 andi r2,r3,0x0004        |
  001818fc: 00000000 nop
+
  001818b0: 10400003 beq r2,r0,0x801818c0    {{f/Cond|If Unit has [Materia Blade] flag}}
00181900: 93a200b8 lbu r2,0x00b8(r29) load primary skillset
+
  001818b4: 30620008 andi r2,r3,0x0008            |{{f/std|}}
00181904: 0806064f j 0x 0018193c
+
  001818b8: 34090001 ori r9,r0,0x0001            |{{f/std|}}
  00181908: 2445fffb addiu r5,r2,0xfffb
+
  001818bc: afa900e0 sw r9,0x00e0(r29)            |{{f/store|Enable materia blade flag}}
  0018190c: 92020012 lbu r2,0x0012(r16) load primary skillset
+
  001818c0: 10400003 beq r2,r0,0x801818d0    {{f/Cond|If Unit has [Sword] flag}}
  00181910: 93a300b8 lbu r3,0x00b8(r29)
+
  001818c4: 00000000 nop                          |{{f/std|}}
  00181914: 00000000 nop
+
  001818c8: 34080001 ori r8,r0,0x0001            |{{f/std|}}
  00181918: 10620005 beq r3,r2,0x 00181930 branch if loaded skillset = units primary skillset
+
  001818cc: afa800e8 sw r8,0x00e8(r29)           |{{f/store|Enable sword flag}}
  0018191c: 00002821 addu r5,r0,r0
+
001818d0: 92020006 lbu r2,0x0006(r16)      |{{f/load|Unit gender}}
  00181920: 92020162 lbu r2,0x0162(r16) load special skillset
+
  001818d4: 00000000 nop                      |
  00181924: 00000000 nop
+
  001818d8: 30420020 andi r2,r2,0x0020        |
  00181928: 14620003 bne r3,r2,0x 00181938 branch if not units primary skillset
+
  001818dc: 14400016 bne r2,r0,0x80181938    {{f/Cond|If Unit is Human}}
  0018192c: 00000000 nop
+
  001818e0: 00000000 nop                          |{{f/std|}}
  00181930: 08060650 j 0x 00181940
+
  001818e4: 93a900b8 lbu r9,0x00b8(r29)           |{{f/load|Skillset ID}}
00181934: 2402ffff addiu r2,r0,0xffff
+
  001818e8: 00000000 nop                          |
  00181938: 2405ffff addiu r5,r0,0xffff
+
  001818ec: 2522fffb addiu r2,r9,-0x0005          |{{f/std|ID-5}}
  0018193c: 2402ffff addiu r2,r0,0xffff
+
  001818f0: 304200ff andi r2,r2,0x00ff            |
  00181940: 14a20004 bne r5,r2,0x 00181954 branch if skillset - 5 is not 0xff
+
  001818f4: 2c420013 sltiu r2,r2,0x0013          |{{f/std|0x1 if Skillset ID is between 0x05 and 0x17}}
  00181944: 3c0800ff lui r8,0x00ff
+
  001818f8: 10400004 beq r2,r0,0x8018190c        {{f/Cond|If Skillset is a Generic skillset}}
  store known abilities = all
+
  001818fc: 00000000 nop                             |{{f/std|}}
00181948: 3508ffff ori r8,r8,0xffff
+
  00181900: 93a200b8 lbu r2,0x00b8(r29)               |{{f/load|Skillset ID}}
  0018194c: 08060658 j 0x 00181960
+
  00181904: 0806064f j 0x8018193c                    {{f/jump|Avoid non-generic skillset section}}
00181950: afa800d0 sw r8,0x00d0(r29)                   store known abilities = all
+
  00181908: 2445fffb addiu r5,r2,-0x0005              |{{f/std|ID-5}}
 
+
                                                '''Else - Not a generic skillset'''
  00181954: 0c017880 jal 0x0005e200 get known abilities
+
  0018190c: 92020012 lbu r2,0x0012(r16)               |{{f/load|Unit Primary skillset}}
  00181958: 02002021 addu r4,r16,r0
+
  00181910: 93a300b8 lbu r3,0x00b8(r29)              |{{f/load|Skillset ID}}
  0018195c: afa200d0 sw r2,0x00d0(r29) store known abilities (fffec0)
+
  00181914: 00000000 nop                              |
00181960: 00009821 addu r19,r0,r0
+
00181918: 10620005 beq r3,r2,0x80181930            {{f/Cond|If Skillset of interest is not the primary skillset (and not generic)}}
  00181964: 03d1b821 addu r23,r30,r17                    0x90 stack address(item)
+
  0018191c: 00002821 addu r5,r0,r0                    |{{f/std|<nowiki>r5 = 0x00</nowiki>}}
  00181968: 03d2b021 addu r22,r30,r18                    0x18 stack address
+
  00181920: 92020162 lbu r2,0x0162(r16)                  |{{f/load|Unit Special skillset}}
0018196c: 8fa900c8 lw r9,0x00c8(r29)                   0x48 stack address(item)
+
  00181924: 00000000 nop                                  |
  00181970: 03d4a821 addu r21,r30,r20                    0x60 stack address
+
  00181928: 14620003 bne r3,r2,0x80181938                {{f/Cond|If Skillset of interest is Unit special skillset}}
  00181974: 03c9a021 addu r20,r30,r9       
+
  0018192c: 00000000 nop                                      |
  00181978: 3c020080 lui r2,0x0080
+
00181930: 08060650 j 0x80181940                            {{f/jump|<nowiki>Keep r5 = 0x00</nowiki>}}
 
+
  00181934: 2402ffff addiu r2,r0,-0x0001                      |{{f/std|<nowiki>r2 = -0x01</nowiki>}}
0018197c: 8fa800d0 lw r8,0x00d0(r29) load known abilities?
+
                                                        '''Else : neither primary nor special non generic skillset'''
  00181980: 02621007 srav r2,r2,r19
+
  00181938: 2405ffff addiu r5,r0,-0x0001                      |{{f/std|<nowiki>r5 = -0x01</nowiki>}}
00181984: 01021024 and r2,r8,r2 known abilities and 0x800000
+
  0018193c: 2402ffff addiu r2,r0,-0x0001                      |{{f/std|<nowiki>r2 = -0x01</nowiki>}}
  00181988: 10400064 beq r2,r0,0x 00181b1c
+
  00181940: 14a20004 bne r5,r2,0x80181954    {{f/Cond|If r5 <> -0x01 (Monster - Human with non generic skillset (not primary nor special)}}
  0018198c: 00000000 nop
+
  00181944: 3c0800ff lui r8,0x00ff                |{{f/std|}}
  00181990: 93a400b8 lbu r4,0x00b8(r29) load skillset
+
  00181948: 3508ffff ori r8,r8,0xffff            |{{f/std|0x00ffffff}}
  00181994: 0c01695a jal 0x0005a568 load ability from skillset
+
  0018194c: 08060658 j 0x80181960                {{f/jump|Avoid Get know abilities section}}
  00181998: 02602821 addu r5,r19,r0
+
  00181950: afa800d0 sw r8,0x00d0(r29)            |{{f/store|Store all abilities learned}}
  0018199c: 8fa90100 lw r9,0x0100(r29) load frog flag
+
                                            '''Else : Search known abilities (generic skillset or special unit skillset)'''
  001819a0: 00402021 addu r4,r2,r0
+
  00181954: 0c017880 jal 0x8005e200              |{{f/jal|Get_Known_Abilities|Get_Known_Abilities}} {{f/std|returns r2 with known abilities flags}}
  001819a4: 11200006 beq r9,r0,0x 001819c0 branch if ?? status present?
+
  00181958: 02002021 addu r4,r16,r0              |{{f/std|Send Unit pointer}}
  001819a8: a7a400d8 sh r4,0x00d8(r29) store ability
+
  0018195c: afa200d0 sw r2,0x00d0(r29)           |{{f/store|Store learned Abilities}}
if frog
+
  00181960: 00009821 addu r19,r0,r0          |{{f/std|Initialize counter}}
  001819ac: 00041400 sll r2,r4,0x10
+
  00181964: 03d1b821 addu r23,r30,r17        |{{f/adr|Pointer to Turns List}}
  001819b0: 00021403 sra r2,r2,0x10
+
  00181968: 03d2b021 addu r22,r30,r18        |{{f/adr|Pointer to Flags List}}
  001819b4: 3403001d ori r3,r0,0x001d
+
  0018196c: 8fa900c8 lw r9,0x00c8(r29)       |{{f/adr|Pointer to MP cost List}}
  001819b8: 14430058 bne r2,r3,0x 00181b1c branch if ability is not 0x1d frog?
+
  00181970: 03d4a821 addu r21,r30,r20        |{{f/adr|Pointer to CT List }}
001819bc: 00000000 nop
+
  00181974: 03c9a021 addu r20,r30,r9          |{{f/adr|Pointer to MP cost List}}
 
+
  00181978: 3c020080 lui r2,0x0080            |{{f/std|Bitmask}}
  001819c0: 00041400 sll r2,r4,0x10
+
                                            {{f/bloop|LOOP - Check All active Ability known flags}}
001819c4: 00021c03 sra r3,r2,0x10
+
  0018197c: 8fa800d0 lw r8,0x00d0(r29)            |{{f/adr|Known Abilities flags}}
  001819c8: 10600054 beq r3,r0,0x 00181b1c branch if ability = 0
+
  00181980: 02621007 srav r2,r2,r19              |{{f/std|Bitmask to this iteration Ability}}
  001819cc: 2482ffff addiu r2,r4,0xffff
+
  00181984: 01021024 and r2,r8,r2                |{{f/std|Check if known}}
001819d0: 3042ffff andi r2,r2,0xffff
+
  00181988: 10400064 beq r2,r0,0x80181b1c        {{f/Cond|If Ability is known}}
  001819d4: 2c42016f sltiu r2,r2,0x016f
+
  0018198c: 00000000 nop                             |{{f/std|}}
  001819d8: 10400036 beq r2,r0,0x 00181ab4 branch if ability is not a regular ability
+
  00181990: 93a400b8 lbu r4,0x00b8(r29)               |{{f/load|Skillset ID}}
  regular ability
+
  00181994: 0c01695a jal 0x8005a568                  |{{f/jal|Load_Ability_From_Skillset|Load_Ability_From_Skillset}} {{f/std|returns Ability ID}}
001819dc: 000310c0 sll r2,r3,0x03
+
  00181998: 02602821 addu r5,r19,r0                   |{{f/std|Send Ability counter}}
  001819e0: 00431023 subu r2,r2,r3
+
  0018199c: 8fa90100 lw r9,0x0100(r29)                |{{f/adr|Frog flag}}
  001819e4: 00021040 sll r2,r2,0x01
+
  001819a0: 00402021 addu r4,r2,r0                    |{{f/std|This iteration Ability ID}}
001819e8: 3c038006 lui r3,0x8006
+
  001819a4: 11200006 beq r9,r0,0x801819c0            {{f/Cond|If Unit is a Frog}}
  001819ec: 2463fbf0 addiu r3,r3,0xfbf0 load ability data pointer 2
+
  001819a8: a7a400d8 sh r4,0x00d8(r29)               |{{f/store|Store Ability ID}}
  001819f0: 00432021 addu r4,r2,r3
+
  001819ac: 00041400 sll r2,r4,0x10                      |{{f/std|}}
  001819f4: 90830006 lbu r3,0x0006(r4)
+
  001819b0: 00021403 sra r2,r2,0x10                      |{{f/std|}}
  001819f8: 00000000 nop
+
  001819b4: 3403001d ori r3,r0,0x001d                    |{{f/std|}}
  001819fc: 30620008 andi r2,r3,0x0008
+
  001819b8: 14430058 bne r2,r3,0x80181b1c                {{f/Cond|If This iteration Ability is Not Frog (spell) : Branch to}} {{f/loc| Next iteration }}
  00181a00: 10400005 beq r2,r0,0x 00181a18 ability requires sword check
+
  001819bc: 00000000 nop                                      |{{f/std|}}
  00181a04: 00000000 nop
+
001819c0: 00041400 sll r2,r4,0x10                  |{{f/std|}}
00181a08: 8fa800e8 lw r8,0x00e8(r29)
+
  001819c4: 00021c03 sra r3,r2,0x10                  |{{f/std|}}
  00181a0c: 00000000 nop
+
  001819c8: 10600054 beq r3,r0,0x80181b1c            {{f/Cond|<nowiki>If Ability ID = 0x00 : branch to </nowiki>}} {{f/loc| Next iteration }}
  00181a10: 11000042 beq r8,r0,0x 00181b1c
+
  001819cc: 2482ffff addiu r2,r4,-0x0001             |{{f/std|}}
  00181a14: 00000000 nop
+
  001819d0: 3042ffff andi r2,r2,0xffff                |{{f/std|Ability ID-1}}
  00181a18: 30620004 andi r2,r3,0x0004
+
  001819d4: 2c42016f sltiu r2,r2,0x016f              |
  00181a1c: 10400005 beq r2,r0,0x 00181a34 ability requires materia blade check
+
  001819d8: 10400036 beq r2,r0,0x80181ab4            {{f/Cond|If Ability ID is between 0x01 and 0x16E}}
  00181a20: 00000000 nop
+
  001819dc: 000310c0 sll r2,r3,0x03                      |{{f/std|}}
  00181a24: 8fa900e0 lw r9,0x00e0(r29)
+
  001819e0: 00431023 subu r2,r2,r3                        |{{f/std|}}
  00181a28: 00000000 nop
+
  001819e4: 00021040 sll r2,r2,0x01                      |{{f/std|Ability ID * 14}}
  00181a2c: 1120003b beq r9,r0,0x 00181b1c
+
  001819e8: 3c038006 lui r3,0x8006                        |
00181a30: 00000000 nop
+
001819ec: 2463fbf0 addiu r3,r3,-0x0410                  |
00181a34: 8fa800f8 lw r8,0x00f8(r29) load (half of mp check?)
+
  001819f0: 00432021 addu r4,r2,r3                        |{{f/adr|Pointer to This iteration Ability Data 2}}
  00181a38: 9091000d lbu r17,0x000d(r4) load MP cost
+
  001819f4: 90830006 lbu r3,0x0006(r4)                   |{{f/load|Ability flag 4}}
  00181a3c: 11000002 beq r8,r0,0x 00181a48
+
  001819f8: 00000000 nop                                  |
  00181a40: 26220001 addiu r2,r17,0x0001
+
  001819fc: 30620008 andi r2,r3,0x0008                    |
  00181a44: 00028843 sra r17,r2,0x01 MP cost / 2
+
  00181a00: 10400005 beq r2,r0,0x80181a18                {{f/Cond|If Ability Requires sword}}
  00181a48: 9082000c lbu r2,0x000c(r4) load CT
+
  00181a04: 00000000 nop                                      |{{f/std|}}
  00181a4c: 90830005 lbu r3,0x0005(r4) load flags 3
+
00181a08: 8fa800e8 lw r8,0x00e8(r29)                       |{{f/adr|Sword flag}}
  00181a50: 3050007f andi r16,r2,0x007f r16 = CT
+
  00181a0c: 00000000 nop                                      |
  00181a54: 000321c2 srl r4,r3,0x07
+
  00181a10: 11000042 beq r8,r0,0x80181b1c                    {{f/Cond|If Sword Flag is OFF : branch to}} {{f/loc| Next iteration }}
  00181a58: 30620020 andi r2,r3,0x0020 affected by silence
+
  00181a14: 00000000 nop                                      |{{f/std|}}
  00181a5c: 00021102 srl r2,r2,0x04
+
  00181a18: 30620004 andi r2,r3,0x0004                    |{{f/std|}}
  00181a60: 30630004 andi r3,r3,0x0004 persevere
+
  00181a1c: 10400005 beq r2,r0,0x80181a34                {{f/Cond|If Ability Requires Materia Blade}}
  00181a64: 1460000b bne r3,r0,0x 00181a94 branch if persevere true
+
  00181a20: 00000000 nop                                      |
  00181a68: 00829025 or r18,r4,r2 r18 = silence and persevere checks
+
  00181a24: 8fa900e0 lw r9,0x00e0(r29)                        |{{f/adr|Materia blade flag}}
00181a6c: 8fa900f0 lw r9,0x00f0(r29)
+
  00181a28: 00000000 nop                                      |
  00181a70: 34020001 ori r2,r0,0x0001
+
  00181a2c: 1120003b beq r9,r0,0x80181b1c                    {{f/Cond|If Materia Blade Flag is OFF : branch to}} {{f/loc| Next iteration }}
  00181a74: 15220002 bne r9,r2,0x 00181a80 short charge check
+
  00181a30: 00000000 nop                                      |{{f/std|}}
  00181a78: 26020001 addiu r2,r16,0x0001
+
  00181a34: 8fa800f8 lw r8,0x00f8(r29)                   |{{f/adr|Half of MP flag}}
  00181a7c: 00028043 sra r16,r2,0x01 (CT+1) / 2
+
  00181a38: 9091000d lbu r17,0x000d(r4)                  |{{f/load|MP Cost}}
  00181a80: 8fa800f0 lw r8,0x00f0(r29)
+
  00181a3c: 11000002 beq r8,r0,0x80181a48                {{f/Cond|If Half of MP flag is ON}}
  00181a84: 34020002 ori r2,r0,0x0002
+
  00181a40: 26220001 addiu r2,r17,0x0001                      |{{f/std|}}
  00181a88: 15020003 bne r8,r2,0x 00181a98 non-charge check
+
  00181a44: 00028843 sra r17,r2,0x01                          |{{f/std|(MP Cost+1)/2}}
  00181a8c: 02002821 addu r5,r16,r0 store (CT + 1)/2
+
  00181a48: 9082000c lbu r2,0x000c(r4)                   |{{f/load|Ability CT}}
  00181a90: 00008021 addu r16,r0,r0
+
  00181a4c: 90830005 lbu r3,0x0005(r4)                   |{{f/load|Ability Flag 3}}
  00181a94: 02002821 addu r5,r16,r0 store 0 CT
+
  00181a50: 3050007f andi r16,r2,0x007f                  |{{f/std|Ability CT}}
00181a98: 8fa400b0 lw r4,0x00b0(r29) load Unit ID
+
  00181a54: 000321c2 srl r4,r3,0x07                      |{{f/std|0x1 if Ability is reflectable}}
  00181a9c: 0c0605c8 jal 0x 00181720 ability loading?
+
  00181a58: 30620020 andi r2,r3,0x0020                    |
  00181aa0: 27a60010 addiu r6,r29,0x0010
+
  00181a5c: 00021102 srl r2,r2,0x04                      |{{f/std|0x2 if Ability is affected by silence}}
  00181aa4: a2910000 sb r17,0x0000(r20) store MP cost ??? stack
+
  00181a60: 30630004 andi r3,r3,0x0004                    |{{f/std|0x4 if Ability has performing flag}}
  00181aa8: a2b00000 sb r16,0x0000(r21) store CT      0x60 stack
+
  00181a64: 1460000b bne r3,r0,0x80181a94                {{f/Cond|If Ability don't have Performing flag}}
  00181aac: 080606bc j 0x 00181af0
+
  00181a68: 00829025 or r18,r4,r2                        |{{f/std|Silence and Reflect flags}}
  00181ab0: a2d20000 sb r18,0x0000(r22) store silence/persevere checks? 0x18 stack
+
  00181a6c: 8fa900f0 lw r9,0x00f0(r29)                       |{{f/adr|Charge Mod}}
  00181ab4: 2482fe6a addiu r2,r4,0xfe6a
+
  00181a70: 34020001 ori r2,r0,0x0001                        |
  00181ab8: 3042ffff andi r2,r2,0xffff
+
  00181a74: 15220002 bne r9,r2,0x80181a80                    {{f/Cond|If Unit uses Short Charge}}
  00181abc: 2c420008 sltiu r2,r2,0x0008
+
  00181a78: 26020001 addiu r2,r16,0x0001                         |{{f/std|}}
  00181ac0: 1040000c beq r2,r0,0x 00181af4 branch if not charge ability
+
  00181a7c: 00028043 sra r16,r2,0x01                              |{{f/std|<nowiki>                  CT = (CT + 1) / 2</nowiki>}}
  00181ac4: 00031040 sll r2,r3,0x01
+
  00181a80: 8fa800f0 lw r8,0x00f0(r29)                        |{{f/adr|Charge Mod}}
00181ac8: 27a60010 addiu r6,r29,0x0010
+
00181a84: 34020002 ori r2,r0,0x0002                        |{{f/std|}}
  00181acc: 3c018006 lui r1,0x8006
+
00181a88: 15020003 bne r8,r2,0x80181a98                    {{f/Cond|If Unit uses Non-Charge}}
  00181ad0: 00220821 addu r1,r1,r2
+
00181a8c: 02002821 addu r5,r16,r0                              |{{f/std|}}
  00181ad4: 90300d18 lbu r16,0x0d18(r1) load CT?
+
00181a90: 00008021 addu r16,r0,r0                              |{{f/std|<nowiki>CT= 0</nowiki>}}
  00181ad8: 8fa400b0 lw r4,0x00b0(r29)                   unit id
+
00181a94: 02002821 addu r5,r16,r0                      |{{f/std|Send CT}}
  00181adc: 0c0605c8 jal 0x 00181720
+
00181a98: 8fa400b0 lw r4,0x00b0(r29)                    |{{f/adr|Unit ID}}
  00181ae0: 02002821 addu r5,r16,r0
+
00181a9c: 0c0605c8 jal 0x80181720                      |{{f/jal|Get_Number_of_Turns_to_Resolve|Get_Number_of_Turns_to_Resolve}}
  00181ae4: a2800000 sb r0,0x0000(r20) store 0 for mp cost    ??? stack
+
00181aa0: 27a60010 addiu r6,r29,0x0010                  |{{f/std|AT List pointer}}
  00181ae8: a2b00000 sb r16,0x0000(r21) store CT              0x60 stack
+
00181aa4: a2910000 sb r17,0x0000(r20)                  |{{f/store|Store MP cost on dynamic List}}
  00181aec: a2c00000 sb r0,0x0000(r22) store 0 for silence/persevere checks    0x18
+
00181aa8: a2b00000 sb r16,0x0000(r21)                  |{{f/store|Store Ability CT on dynamic List}}
  00181af0: a2e20000 sb r2,0x0000(r23) store Turns            0x90 stack
+
00181aac: 080606bc j 0x80181af0                        {{f/jump|Avoid section for ability without data 2}}
  00181af4: 26f70001 addiu r23,r23,0x0001
+
00181ab0: a2d20000 sb r18,0x0000(r22)                  |{{f/store|Store Silence/Reflect flag on Dynamic list}}
  00181af8: 26d60001 addiu r22,r22,0x0001
+
                                                    '''Else : Ability ID >= 170'''
  00181afc: 26b50001 addiu r21,r21,0x0001
+
00181ab4: 2482fe6a addiu r2,r4,-0x0196              |{{f/std|Ability ID -0x196}}
  00181b00: 26940001 addiu r20,r20,0x0001
+
00181ab8: 3042ffff andi r2,r2,0xffff                |
  00181b04: 97a800d8 lhu r8,0x00d8(r29) load ability ID
+
00181abc: 2c420008 sltiu r2,r2,0x0008              |
  00181b08: 8fa900c0 lw r9,0x00c0(r29) load pointer address 0x20
+
00181ac0: 1040000c beq r2,r0,0x80181af4            {{f/Cond|If This Ability is a Charge Ability (Archer)}}
  00181b0c: 27de0001 addiu r30,r30,0x0001
+
00181ac4: 00031040 sll r2,r3,0x01                      |{{f/std|Ability ID *2}}
  00181b10: a5280000 sh r8,0x0000(r9) store ability ID
+
00181ac8: 27a60010 addiu r6,r29,0x0010                  |{{f/std|AT List Pointer}}
  00181b14: 25290002 addiu r9,r9,0x0002
+
00181acc: 3c018006 lui r1,0x8006                        |
  00181b18: afa900c0 sw r9,0x00c0(r29) store new stack pointer?
+
00181ad0: 00220821 addu r1,r1,r2                        |
  00181b1c: 26730001 addiu r19,r19,0x0001
+
00181ad4: 90300d18 lbu r16,0x0d18(r1)                  |{{f/load|Load This Ability Charge CT }} {{f/std|<nowiki>80060d18 + 0x196*2 = 80061044</nowiki>}}
  00181b20: 2a620010 slti r2,r19,0x0010 run 15 times - for each ability?
+
00181ad8: 8fa400b0 lw r4,0x00b0(r29)                    |
  00181b24: 1440ff95 bne r2,r0,0x 0018197c
+
00181adc: 0c0605c8 jal 0x80181720                      |{{f/jal|Get_Number_of_Turns_to_Resolve|Get_Number_of_Turns_to_Resolve}}
00181b28: 3c020080 lui r2,0x0080
+
00181ae0: 02002821 addu r5,r16,r0                      |{{f/std|Send CT}}
 
+
00181ae4: a2800000 sb r0,0x0000(r20)                    |{{f/store|<nowiki>Store MP cost = 0x00</nowiki>}}
00181b2c: 8fa900c0 lw r9,0x00c0(r29)                  0x20 address
+
00181ae8: a2b00000 sb r16,0x0000(r21)                  |{{f/store|Store CT}}
00181b30: 2402ffff addiu r2,r0,0xffff                  store end of list
+
00181aec: a2c00000 sb r0,0x0000(r22)                    |{{f/store|Nullify silence/reflect}}
  00181b34: a5220000 sh r2,0x0000(r9) store ??
+
00181af0: a2e20000 sb r2,0x0000(r23)                |{{f/store|Store Nb of Turns to resolve on dynamic list}}
  00181b38: 03c01021 addu r2,r30,r0 return number of abilities?
+
00181af4: 26f70001 addiu r23,r23,0x0001            |{{f/adr|Dynamic pointer to Turn List (+1 each known ability)}}
  00181b3c: 8fbf012c lw r31,0x012c(r29)
+
00181af8: 26d60001 addiu r22,r22,0x0001            |{{f/adr|Dynamic pointer to Silence/Reflect List (+1 each known ability)}}
 +
00181afc: 26b50001 addiu r21,r21,0x0001            |{{f/adr|Dynamic pointer to CT List (+1 each known ability)}}
 +
00181b00: 26940001 addiu r20,r20,0x0001            |{{f/adr|Dynamic pointer to MP List (+1 each known ability)}}
 +
00181b04: 97a800d8 lhu r8,0x00d8(r29)              |{{f/load|Load Ability ID}}
 +
00181b08: 8fa900c0 lw r9,0x00c0(r29)                |{{f/adr|Pointer to Ability ID list}}
 +
00181b0c: 27de0001 addiu r30,r30,0x0001            |{{f/std|Known Ability Counter + 1}}
 +
00181b10: a5280000 sh r8,0x0000(r9)                |{{f/store|Store Ability ID}}
 +
00181b14: 25290002 addiu r9,r9,0x0002              |{{f/adr|Dynamic pointer to ID List (+1 each known ability)}}
 +
00181b18: afa900c0 sw r9,0x00c0(r29)                |{{f/store|Store pointer}}
 +
00181b1c: 26730001 addiu r19,r19,0x0001        |{{f/std|Counter + 1}}
 +
00181b20: 2a620010 slti r2,r19,0x0010          |{{f/std|Check limit (0x10 Abilities Per skillset)}}
 +
00181b24: 1440ff95 bne r2,r0,0x8018197c    {{f/eloop|loop}}
 +
00181b28: 3c020080 lui r2,0x0080                |{{f/std|restore Bitmask}}
 +
00181b2c: 8fa900c0 lw r9,0x00c0(r29)        |{{f/adr|Pointer to Ability ID list}}
 +
00181b30: 2402ffff addiu r2,r0,-0x0001      |
 +
  00181b34: a5220000 sh r2,0x0000(r9)         |{{f/store|End list with 0xffff}}
 +
  00181b38: 03c01021 addu r2,r30,r0           |{{f/std|Returns Known Abilities counter}}
 +
  00181b3c: 8fbf012c lw r31,0x012c(r29)       END
 
  00181b40: 8fbe0128 lw r30,0x0128(r29)
 
  00181b40: 8fbe0128 lw r30,0x0128(r29)
 
  00181b44: 8fb70124 lw r23,0x0124(r29)
 
  00181b44: 8fb70124 lw r23,0x0124(r29)
Line 244: Line 261:
 
  00181b68: 03e00008 jr r31
 
  00181b68: 03e00008 jr r31
 
  00181b6c: 00000000 nop
 
  00181b6c: 00000000 nop
 +
===Return location===
 +
'''Battle.bin'''
 +
0013fc20: [[Main_Skillset/ability_loading]]
 +
00179e94: [[Set_Jump_Ability_Targeting]]
 +
00181638: [[Skillset_Loading%3F]]
 +
00181c0c: [[Item_Ability_Loading]]
 +
00181d68: [[Throw]]
 +
00181fbc: [[Math_Skill]]
 +
0018212c: [[Math_Skill_ability_loading]]
 +
00182238: [[Elemental_ability_loading]]
 +
00182700: [[Draw_Out_2_(main_routine)]]
 +
001827e0: [[Charge_Skillset_Loading]]

Latest revision as of 06:28, 4 August 2023

BATTLE.BIN - Able_to_move/act_checks_(Menu%3F)
---------------------------------------------------------------------------------------
Parameter : r4 = Unit Battle ID
            r5 = Skillset ID
            r6 = Pointer to output list of Ability ID
            r7 = Pointer to output list of Ability MP cost
            Previous routine Stack Pointer is used to pass other pointers
                Stack 0x10 - Pointer to output list of Ability CT
                Stack 0x14 - Unused pointer ?
                Stack 0x18 - Pointer to output list of Ability Silence/Reflect flags
                Stack 0x1c - Pointer to output list of Nb of Turns unit resolution

Returns : r2 Nb of known and usable Abilities in skillset

This Routine will : - check known abilities in skillset, 
                    - check they can be used (sword - matera blade- Frog). 
                    - Set their CT (check short charge or non charge)
                    - Set their MP cost (checking half MP)
                    - Fill the lists
---------------------------------------------------------------------------------------
001817c0: 27bdfed0 addiu r29,r29,-0x0130    |
001817c4: afa400b0 sw r4,0x00b0(r29)        |
001817c8: 8fa400b0 lw r4,0x00b0(r29)        |Unit Battle ID
001817cc: afb40118 sw r20,0x0118(r29)       |
001817d0: 8fb40140 lw r20,0x0140(r29)       |Pointer to CT List 
001817d4: afb20110 sw r18,0x0110(r29)       |
001817d8: 8fb20148 lw r18,0x0148(r29)       |Pointer to Flags List  Silence Reflect Performing
001817dc: afb1010c sw r17,0x010c(r29)       |
001817e0: 8fb1014c lw r17,0x014c(r29)       |Pointer to Turns List
001817e4: afbe0128 sw r30,0x0128(r29)       |
001817e8: 0000f021 addu r30,r0,r0           |Initialize Nb of Abilities
001817ec: afbf012c sw r31,0x012c(r29)       |
001817f0: afb70124 sw r23,0x0124(r29)       |
001817f4: afb60120 sw r22,0x0120(r29)       |
001817f8: afb5011c sw r21,0x011c(r29)       |
001817fc: afb30114 sw r19,0x0114(r29)       |
00181800: afb00108 sw r16,0x0108(r29)       |
00181804: afa600c0 sw r6,0x00c0(r29)        |Store Pointer to Ability ID list
00181808: afa000e0 sw r0,0x00e0(r29)        |Initialize Materia Blade flag
0018180c: afa000e8 sw r0,0x00e8(r29)        |Initialize Sword flag
00181810: afa000f0 sw r0,0x00f0(r29)        |Initialize Charge Mod
00181814: afa000f8 sw r0,0x00f8(r29)        |Initialize Half MP flag
00181818: afa00100 sw r0,0x0100(r29)        |Initialize Frog Flag
0018181c: afa700c8 sw r7,0x00c8(r29)        |Store Pointer to MP cost
00181820: 0c060435 jal 0x801810d4           |-->Get_Existent_Battle_Unit_Pointer returns r2 = Unit data pointer (r4 ID)
00181824: a3a500b8 sb r5,0x00b8(r29)        |Store Skillset ID
00181828: 00408021 addu r16,r2,r0           |Pointer to Unit battle data
0018182c: 120000c3 beq r16,r0,0x80181b3c    #If Pointer is invalid :   Exit and returns 0x00
00181830: 00001021 addu r2,r0,r0                |
00181834: 9202005a lbu r2,0x005a(r16)       |Unit Current Status 3
00181838: 00000000 nop                      |
0018183c: 30420002 andi r2,r2,0x0002        |
00181840: 10400003 beq r2,r0,0x80181850     #If Unit has [Frog]
00181844: 00000000 nop                          |
00181848: 34090001 ori r9,r0,0x0001             |
0018184c: afa90100 sw r9,0x0100(r29)            |Enable Frog flag
00181850: 92020090 lbu r2,0x0090(r16)       |Unit Support 2
00181854: 00000000 nop                      |
00181858: 30420080 andi r2,r2,0x0080        |
0018185c: 10400003 beq r2,r0,0x8018186c     #If Unit uses [Half of MP]
00181860: 00000000 nop                          |
00181864: 34080001 ori r8,r0,0x0001             |
00181868: afa800f8 sw r8,0x00f8(r29)            |Enable half of MP flag
0018186c: 92030092 lbu r3,0x0092(r16)       |Unit Support 4
00181870: 00000000 nop                      |
00181874: 30620004 andi r2,r3,0x0004        |
00181878: 10400003 beq r2,r0,0x80181888     #If Unit uses [Non-Charge]
0018187c: 34090002 ori r9,r0,0x0002             |
00181880: 08060626 j 0x80181898                 >>Avoid Short Charge
00181884: afa900f0 sw r9,0x00f0(r29)            |Store Charge Mod = 0x02
                                            Else - No non-charge
00181888: 30620008 andi r2,r3,0x0008        |
0018188c: 10400002 beq r2,r0,0x80181898     #If Unit uses [Short-Charge]
00181890: 34080001 ori r8,r0,0x0001             |
00181894: afa800f0 sw r8,0x00f0(r29)            |Store Charge Mod = 0x01
00181898: 27a40010 addiu r4,r29,0x0010      |Send Pointer
0018189c: 0c060dc3 jal 0x8018370c           |-->Calculate_AT_List Store AT list on Pointer
001818a0: 00002821 addu r5,r0,r0            |
001818a4: 92030184 lbu r3,0x0184(r16)       |Unit Equipped flags
001818a8: 00000000 nop                      |
001818ac: 30620004 andi r2,r3,0x0004        |
001818b0: 10400003 beq r2,r0,0x801818c0     #If Unit has [Materia Blade] flag
001818b4: 30620008 andi r2,r3,0x0008            |
001818b8: 34090001 ori r9,r0,0x0001             |
001818bc: afa900e0 sw r9,0x00e0(r29)            |Enable materia blade flag
001818c0: 10400003 beq r2,r0,0x801818d0     #If Unit has [Sword] flag
001818c4: 00000000 nop                          |
001818c8: 34080001 ori r8,r0,0x0001             |
001818cc: afa800e8 sw r8,0x00e8(r29)            |Enable sword flag
001818d0: 92020006 lbu r2,0x0006(r16)       |Unit gender
001818d4: 00000000 nop                      |
001818d8: 30420020 andi r2,r2,0x0020        |
001818dc: 14400016 bne r2,r0,0x80181938     #If Unit is Human
001818e0: 00000000 nop                          |
001818e4: 93a900b8 lbu r9,0x00b8(r29)           |Skillset ID
001818e8: 00000000 nop                          |
001818ec: 2522fffb addiu r2,r9,-0x0005          |ID-5
001818f0: 304200ff andi r2,r2,0x00ff            |
001818f4: 2c420013 sltiu r2,r2,0x0013           |0x1 if Skillset ID is between 0x05 and 0x17
001818f8: 10400004 beq r2,r0,0x8018190c         #If Skillset is a Generic skillset
001818fc: 00000000 nop                              |
00181900: 93a200b8 lbu r2,0x00b8(r29)               |Skillset ID
00181904: 0806064f j 0x8018193c                     >>Avoid non-generic skillset section
00181908: 2445fffb addiu r5,r2,-0x0005              |ID-5
                                                Else - Not a generic skillset
0018190c: 92020012 lbu r2,0x0012(r16)               |Unit Primary skillset
00181910: 93a300b8 lbu r3,0x00b8(r29)               |Skillset ID
00181914: 00000000 nop                              |
00181918: 10620005 beq r3,r2,0x80181930             #If Skillset of interest is not the primary skillset (and not generic)
0018191c: 00002821 addu r5,r0,r0                    |r5 = 0x00
00181920: 92020162 lbu r2,0x0162(r16)                   |Unit Special skillset
00181924: 00000000 nop                                  |
00181928: 14620003 bne r3,r2,0x80181938                 #If Skillset of interest is Unit special skillset
0018192c: 00000000 nop                                      |
00181930: 08060650 j 0x80181940                             >>Keep r5 = 0x00
00181934: 2402ffff addiu r2,r0,-0x0001                      |r2 = -0x01
                                                        Else : neither primary nor special non generic skillset
00181938: 2405ffff addiu r5,r0,-0x0001                      |r5 = -0x01
0018193c: 2402ffff addiu r2,r0,-0x0001                      |r2 = -0x01
00181940: 14a20004 bne r5,r2,0x80181954     #If r5 <> -0x01 (Monster - Human with non generic skillset (not primary nor special)
00181944: 3c0800ff lui r8,0x00ff                |
00181948: 3508ffff ori r8,r8,0xffff             |0x00ffffff
0018194c: 08060658 j 0x80181960                 >>Avoid Get know abilities section
00181950: afa800d0 sw r8,0x00d0(r29)            |Store all abilities learned
                                            Else : Search known abilities (generic skillset or special unit skillset)
00181954: 0c017880 jal 0x8005e200               |-->Get_Known_Abilities returns r2 with known abilities flags
00181958: 02002021 addu r4,r16,r0               |Send Unit pointer
0018195c: afa200d0 sw r2,0x00d0(r29)            |Store learned Abilities
00181960: 00009821 addu r19,r0,r0           |Initialize counter
00181964: 03d1b821 addu r23,r30,r17         |Pointer to Turns List
00181968: 03d2b021 addu r22,r30,r18         |Pointer to Flags List
0018196c: 8fa900c8 lw r9,0x00c8(r29)        |Pointer to MP cost List
00181970: 03d4a821 addu r21,r30,r20         |Pointer to CT List 
00181974: 03c9a021 addu r20,r30,r9          |Pointer to MP cost List
00181978: 3c020080 lui r2,0x0080            |Bitmask
                                            @LOOP - Check All active Ability known flags
0018197c: 8fa800d0 lw r8,0x00d0(r29)            |Known Abilities flags
00181980: 02621007 srav r2,r2,r19               |Bitmask to this iteration Ability
00181984: 01021024 and r2,r8,r2                 |Check if known
00181988: 10400064 beq r2,r0,0x80181b1c         #If Ability is known
0018198c: 00000000 nop                              |
00181990: 93a400b8 lbu r4,0x00b8(r29)               |Skillset ID
00181994: 0c01695a jal 0x8005a568                   |-->Load_Ability_From_Skillset returns Ability ID
00181998: 02602821 addu r5,r19,r0                   |Send Ability counter
0018199c: 8fa90100 lw r9,0x0100(r29)                |Frog flag
001819a0: 00402021 addu r4,r2,r0                    |This iteration Ability ID
001819a4: 11200006 beq r9,r0,0x801819c0             #If Unit is a Frog
001819a8: a7a400d8 sh r4,0x00d8(r29)                |Store Ability ID
001819ac: 00041400 sll r2,r4,0x10                       |
001819b0: 00021403 sra r2,r2,0x10                       |
001819b4: 3403001d ori r3,r0,0x001d                     |
001819b8: 14430058 bne r2,r3,0x80181b1c                 #If This iteration Ability is Not Frog (spell) : Branch to  Next iteration 
001819bc: 00000000 nop                                      |
001819c0: 00041400 sll r2,r4,0x10                   |
001819c4: 00021c03 sra r3,r2,0x10                   |
001819c8: 10600054 beq r3,r0,0x80181b1c             #If Ability ID = 0x00 : branch to   Next iteration 
001819cc: 2482ffff addiu r2,r4,-0x0001              |
001819d0: 3042ffff andi r2,r2,0xffff                |Ability ID-1
001819d4: 2c42016f sltiu r2,r2,0x016f               |
001819d8: 10400036 beq r2,r0,0x80181ab4             #If Ability ID is between 0x01 and 0x16E
001819dc: 000310c0 sll r2,r3,0x03                       |
001819e0: 00431023 subu r2,r2,r3                        |
001819e4: 00021040 sll r2,r2,0x01                       |Ability ID * 14
001819e8: 3c038006 lui r3,0x8006                        |
001819ec: 2463fbf0 addiu r3,r3,-0x0410                  |
001819f0: 00432021 addu r4,r2,r3                        |Pointer to This iteration Ability Data 2
001819f4: 90830006 lbu r3,0x0006(r4)                    |Ability flag 4
001819f8: 00000000 nop                                  |
001819fc: 30620008 andi r2,r3,0x0008                    |
00181a00: 10400005 beq r2,r0,0x80181a18                 #If Ability Requires sword
00181a04: 00000000 nop                                      |
00181a08: 8fa800e8 lw r8,0x00e8(r29)                        |Sword flag
00181a0c: 00000000 nop                                      |
00181a10: 11000042 beq r8,r0,0x80181b1c                     #If Sword Flag is OFF : branch to  Next iteration 
00181a14: 00000000 nop                                      |
00181a18: 30620004 andi r2,r3,0x0004                    |
00181a1c: 10400005 beq r2,r0,0x80181a34                 #If Ability Requires Materia Blade
00181a20: 00000000 nop                                      |
00181a24: 8fa900e0 lw r9,0x00e0(r29)                        |Materia blade flag
00181a28: 00000000 nop                                      |
00181a2c: 1120003b beq r9,r0,0x80181b1c                     #If Materia Blade Flag is OFF : branch to  Next iteration 
00181a30: 00000000 nop                                      |
00181a34: 8fa800f8 lw r8,0x00f8(r29)                    |Half of MP flag
00181a38: 9091000d lbu r17,0x000d(r4)                   |MP Cost
00181a3c: 11000002 beq r8,r0,0x80181a48                 #If Half of MP flag is ON
00181a40: 26220001 addiu r2,r17,0x0001                      |
00181a44: 00028843 sra r17,r2,0x01                          |(MP Cost+1)/2
00181a48: 9082000c lbu r2,0x000c(r4)                    |Ability CT
00181a4c: 90830005 lbu r3,0x0005(r4)                    |Ability Flag 3
00181a50: 3050007f andi r16,r2,0x007f                   |Ability CT
00181a54: 000321c2 srl r4,r3,0x07                       |0x1 if Ability is reflectable
00181a58: 30620020 andi r2,r3,0x0020                    |
00181a5c: 00021102 srl r2,r2,0x04                       |0x2 if Ability is affected by silence
00181a60: 30630004 andi r3,r3,0x0004                    |0x4 if Ability has performing flag
00181a64: 1460000b bne r3,r0,0x80181a94                 #If Ability don't have Performing flag
00181a68: 00829025 or r18,r4,r2                         |Silence and Reflect flags
00181a6c: 8fa900f0 lw r9,0x00f0(r29)                        |Charge Mod
00181a70: 34020001 ori r2,r0,0x0001                         |
00181a74: 15220002 bne r9,r2,0x80181a80                     #If Unit uses Short Charge
00181a78: 26020001 addiu r2,r16,0x0001                          |
00181a7c: 00028043 sra r16,r2,0x01                              |                   CT = (CT + 1) / 2
00181a80: 8fa800f0 lw r8,0x00f0(r29)                        |Charge Mod
00181a84: 34020002 ori r2,r0,0x0002                         |
00181a88: 15020003 bne r8,r2,0x80181a98                     #If Unit uses Non-Charge
00181a8c: 02002821 addu r5,r16,r0                               |
00181a90: 00008021 addu r16,r0,r0                               |CT= 0
00181a94: 02002821 addu r5,r16,r0                       |Send CT
00181a98: 8fa400b0 lw r4,0x00b0(r29)                    |Unit ID
00181a9c: 0c0605c8 jal 0x80181720                       |-->Get_Number_of_Turns_to_Resolve
00181aa0: 27a60010 addiu r6,r29,0x0010                  |AT List pointer
00181aa4: a2910000 sb r17,0x0000(r20)                   |Store MP cost on dynamic List
00181aa8: a2b00000 sb r16,0x0000(r21)                   |Store Ability CT on dynamic List
00181aac: 080606bc j 0x80181af0                         >>Avoid section for ability without data 2
00181ab0: a2d20000 sb r18,0x0000(r22)                   |Store Silence/Reflect flag on Dynamic list
                                                    Else : Ability ID >= 170
00181ab4: 2482fe6a addiu r2,r4,-0x0196              |Ability ID -0x196
00181ab8: 3042ffff andi r2,r2,0xffff                |
00181abc: 2c420008 sltiu r2,r2,0x0008               |
00181ac0: 1040000c beq r2,r0,0x80181af4             #If This Ability is a Charge Ability (Archer)
00181ac4: 00031040 sll r2,r3,0x01                       |Ability ID *2
00181ac8: 27a60010 addiu r6,r29,0x0010                  |AT List Pointer
00181acc: 3c018006 lui r1,0x8006                        |
00181ad0: 00220821 addu r1,r1,r2                        |
00181ad4: 90300d18 lbu r16,0x0d18(r1)                   |Load This Ability Charge CT  80060d18 + 0x196*2 = 80061044
00181ad8: 8fa400b0 lw r4,0x00b0(r29)                    |
00181adc: 0c0605c8 jal 0x80181720                       |-->Get_Number_of_Turns_to_Resolve
00181ae0: 02002821 addu r5,r16,r0                       |Send CT
00181ae4: a2800000 sb r0,0x0000(r20)                    |Store MP cost = 0x00
00181ae8: a2b00000 sb r16,0x0000(r21)                   |Store CT
00181aec: a2c00000 sb r0,0x0000(r22)                    |Nullify silence/reflect
00181af0: a2e20000 sb r2,0x0000(r23)                |Store Nb of Turns to resolve on dynamic list
00181af4: 26f70001 addiu r23,r23,0x0001             |Dynamic pointer to Turn List (+1 each known ability)
00181af8: 26d60001 addiu r22,r22,0x0001             |Dynamic pointer to Silence/Reflect List (+1 each known ability)
00181afc: 26b50001 addiu r21,r21,0x0001             |Dynamic pointer to CT List (+1 each known ability)
00181b00: 26940001 addiu r20,r20,0x0001             |Dynamic pointer to MP List (+1 each known ability)
00181b04: 97a800d8 lhu r8,0x00d8(r29)               |Load Ability ID
00181b08: 8fa900c0 lw r9,0x00c0(r29)                |Pointer to Ability ID list
00181b0c: 27de0001 addiu r30,r30,0x0001             |Known Ability Counter + 1
00181b10: a5280000 sh r8,0x0000(r9)                 |Store Ability ID
00181b14: 25290002 addiu r9,r9,0x0002               |Dynamic pointer to ID List (+1 each known ability)
00181b18: afa900c0 sw r9,0x00c0(r29)                |Store pointer
00181b1c: 26730001 addiu r19,r19,0x0001         |Counter + 1
00181b20: 2a620010 slti r2,r19,0x0010           |Check limit (0x10 Abilities Per skillset)
00181b24: 1440ff95 bne r2,r0,0x8018197c     Λ loop
00181b28: 3c020080 lui r2,0x0080                |restore Bitmask
00181b2c: 8fa900c0 lw r9,0x00c0(r29)        |Pointer to Ability ID list
00181b30: 2402ffff addiu r2,r0,-0x0001      |
00181b34: a5220000 sh r2,0x0000(r9)         |End list with 0xffff
00181b38: 03c01021 addu r2,r30,r0           |Returns Known Abilities counter
00181b3c: 8fbf012c lw r31,0x012c(r29)       END
00181b40: 8fbe0128 lw r30,0x0128(r29)
00181b44: 8fb70124 lw r23,0x0124(r29)
00181b48: 8fb60120 lw r22,0x0120(r29)
00181b4c: 8fb5011c lw r21,0x011c(r29)
00181b50: 8fb40118 lw r20,0x0118(r29)
00181b54: 8fb30114 lw r19,0x0114(r29)
00181b58: 8fb20110 lw r18,0x0110(r29)
00181b5c: 8fb1010c lw r17,0x010c(r29)
00181b60: 8fb00108 lw r16,0x0108(r29)
00181b64: 27bd0130 addiu r29,r29,0x0130
00181b68: 03e00008 jr r31
00181b6c: 00000000 nop

Return location

Battle.bin
0013fc20: Main_Skillset/ability_loading
00179e94: Set_Jump_Ability_Targeting
00181638: Skillset_Loading?
00181c0c: Item_Ability_Loading
00181d68: Throw
00181fbc: Math_Skill
0018212c: Math_Skill_ability_loading
00182238: Elemental_ability_loading
00182700: Draw_Out_2_(main_routine)
001827e0: Charge_Skillset_Loading