Difference between revisions of "Status infliction/removal"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
m (link to 18e9bc)
m (Nyzer moved page Status infliction/removal? to Status infliction/removal: Fucking question marks)
 
(7 intermediate revisions by 3 users not shown)
Line 1: Line 1:
  status infliction/removal?
+
  Parameters : r4 = Acting unit's data pointer
  0005e7a8: 27bdffd8 addiu r29,r29,0xffd8
+
              r5 = Input value (*4 to determine offset in 0x80059830 table)
  0005e7ac: afb20018 sw r18,0x0018(r29)
+
   
  0005e7b0: 00809021 addu r18,r4,r0 r18 = Unit's Data Pointer
+
  Will update Acting's unit's 0x1bb (infilcted status set 1) and 0x58 (current status set 1)
0005e7b4: 30a300ff andi r3,r5,0x00ff r3 = Status ID?
+
  If r5 = 0x00 : remove everything
0005e7b8: 340200ff ori r2,r0,0x00ff r2 = FF
+
    r5 = 0x05 : inflict charging, remove everything else
  0005e7bc: afbf0024 sw r31,0x0024(r29)
+
    r5 = 0x06 : inflict jump, remove everything else
  0005e7c0: afb40020 sw r20,0x0020(r29)
+
    r5 = 0x07 : inflict defending, remove everything else
  0005e7c4: afb3001c sw r19,0x001c(r29)
+
    r5 = 0x08 : inflict performing, remove everything else
0005e7c8: afb10014 sw r17,0x0014(r29)
+
    r5 = 0xff : if r4 unit is performing act like r5 = 0x08, else r5 = 0x00
0005e7cc: afb00010 sw r16,0x0010(r29)
+
  If r5 = 0x00 0x07 or 0x08 Update r4's 0x015d (Ability CT) with 0x0ff or last used ability CT
0005e7d0: 92540058 lbu r20,0x0058(r18) Load Unit's Current Statuses set 1
+
  -------------------------------------------------------------------------------------------------
0005e7d4: 9253018a lbu r19,0x018a(r18) Load Unit's Unit ID
+
  0005e7a8: 27bdffd8 addiu r29,r29,-0x0028                   
0005e7d8: 1462 0005 bne r3,r2,0x 0005e7f0 Branch if Status ID? != FF
+
  0005e7ac: afb20018 sw r18,0x0018(r29)                       
  0005e7dc: 2c620009 sltiu r2,r3,0x0009
+
  0005e7b0: 00809021 addu r18,r4,r0          |{{f/adr|<nowiki>r18 = Acting Unit's Data Pointer</nowiki>}}
  0005e7e0: 32820001 andi r2,r20,0x0001 Performing Flag
+
  0005e7b4: 30a300ff andi r3,r5,0x00ff       |{{f/std|<nowiki>r3 = Input Value</nowiki>}}
  0005e7e4: 000228c0 sll r5,r2,0x03 Flag * 8 (0 or 8 here)
+
  0005e7b8: 340200ff ori r2,r0,0x00ff        |{{f/std|<nowiki>r2 = 0x0ff</nowiki>}}
  0005e7e8: 30a300ff andi r3,r5,0x00ff (prevent branching)
+
  0005e7bc: afbf0024 sw r31,0x0024(r29)       |
  0005e7ec: 2c620009 sltiu r2,r3,0x0009
+
  0005e7c0: afb40020 sw r20,0x0020(r29)      |
0005e7f0: 10400016 beq r2,r0,0x 0005e84c Branch if Status ID? >= 9
+
  0005e7c4: afb3001c sw r19,0x001c(r29)      |
  0005e7f4: 00031080 sll r2,r3,0x02 ID * 4 (0-0x20)
+
  0005e7c8: afb10014 sw r17,0x0014(r29)       |
  0005e7f8: 3c018006 lui r1,0x8006
+
  0005e7cc: afb00010 sw r16,0x0010(r29)      |
  0005e7fc: 00220821 addu r1,r1,r2
+
  0005e7d0: 92540058 lbu r20,0x0058(r18)      |{{f/load|<nowiki>r20 = Acting unit's current status (0x58)</nowiki>}}
  0005e800: 8c229830 lw r2,-0x67d0(r1) Load Code Pointer for Below
+
  0005e7d4: 9253018a lbu r19,0x018a(r18)      |{{f/load|<nowiki>r19 = Acting unit raw ID (0x18a)</nowiki>}}
  0005e804: 00000000 nop
+
  0005e7d8: 14620005 bne r3,r2,0x0005e7f0    {{f/Cond|<nowiki>If Input Value = 0x0ff</nowiki>}}
  0005e808: 00400008 jr r2
+
  0005e7dc: 2c620009 sltiu r2,r3,0x0009      |{{f/std|<nowiki>r2 = 0x01 if Input Value < 0x09</nowiki>}}
  0005e80c: 00000000 nop
+
  0005e7e0: 32820001 andi r2,r20,0x0001            |{{f/std|<nowiki>r2 = 0x01 if Acting unit is performing / Else 0x00</nowiki>}}
*Normal Action*
+
  0005e7e4: 000228c0 sll r5,r2,0x03                |{{f/std|<nowiki>r5 = 0x08 if Acting unit is performing / Else 0x00</nowiki>}}
0005e810: 00008821 addu r17,r0,r0 r17 = 0 (None)
+
  0005e7e8: 30a300ff andi r3,r5,0x00ff            |{{f/std|<nowiki>r3 = Force Input Value to be  0x08 if Unit is performing else 0x00</nowiki>}}
  0005e814: 08017a12 j 0x 0005e848
+
  0005e7ec: 2c620009 sltiu r2,r3,0x0009            |{{f/std|<nowiki>r2 = 0x01 if Input Value < 0x09</nowiki>}}
  0005e818: 340200ff ori r2,r0,0x00ff CT = FF
+
  0005e7f0: 10400016 beq r2,r0,0x0005e84c    {{f/Cond|<nowiki>If Input Value < 0x08</nowiki>}}
*Charging*
+
  0005e7f4: 00031080 sll r2,r3,0x02                |{{f/std|<nowiki>r2 = Input Value * 4</nowiki>}}
  0005e81c: 08017a13 j 0x 0005e84c
+
  0005e7f8: 3c018006 lui r1,0x8006                |
  0005e820: 34110008 ori r17,r0,0x0008 r17 = 8 (Charging)
+
  0005e7fc: 00220821 addu r1,r1,r2                |
*Jump*
+
0005e800: 8c229830 lw r2,-0x67d0(r1)             |{{f/adr|<nowiki>r2 = Jump Adress from Input Value</nowiki>}} {{f/std|<nowiki> 0x80059830</nowiki>}}
  0005e824: 08017a13 j 0x 0005e84c
+
0005e804: 00000000 nop                          |
  0005e828: 34110004 ori r17,r0,0x0004 r17 = 4 (Jump)
+
  0005e808: 00400008 jr r2                        {{f/jump|<nowiki>jump to section</nowiki>}}
*Defending*
+
  0005e80c: 00000000 nop                          |
  0005e82c: 34110002 ori r17,r0,0x0002 r17 = 2 (Defending)
+
  0005e830: 08017a12 j 0x 0005e848
+
                                            {{f/com|<nowiki>-- Normal Action Input Value = 0x00 --</nowiki>}}
0005e834: 340200ff ori r2,r0,0x00ff CT = FF
+
  0005e810: 00008821 addu r17,r0,r0                   |{{f/std|<nowiki>r17 = 0x00 (no status)</nowiki>}}
*Performing*
+
  0005e814: 08017a12 j 0x0005e848                      {{f/jump|<nowiki>jump after sections (store 0x0ff as Ability CT)</nowiki>}}
  0005e838: 0c0179de jal 0x 0005e778 Transfer Last Ability Used CT
+
  0005e818: 340200ff ori r2,r0,0x00ff                 |{{f/std|<nowiki>r2 = 0x0ff</nowiki>}}
  0005e83c: 02402021 addu r4,r18,r0 r4 = Unit's Data Pointer
+
   
0005e840: 9242018b lbu r2,0x018b(r18) Load Unit's Last Ability CT
+
                                            {{f/com|<nowiki>-- Charging Input Value = 0x05 --</nowiki>}}
  0005e844: 34110001 ori r17,r0,0x0001 r17 = 1 (Performing)
+
  0005e81c: 08017a13 j 0x0005e84c                      {{f/jump|<nowiki>jump after sections (no Ability CT)</nowiki>}}
  0005e848: a242015d sb r2,0x015d(r18) Store Unit's Ability CT
+
  0005e820: 34110008 ori r17,r0,0x0008                |{{f/std|<nowiki>r17  =0x08 (Charge flag in status set 1)</nowiki>}}
*Default*
+
   
0005e84c: 3a30000f xori r16,r17,0x000f r16 = 0xF with r17 Disabled
+
                                            {{f/com|<nowiki>-- Jump Input Value = 0x06 --</nowiki>}}
  0005e850: 02402021 addu r4,r18,r0 r4 = Unit's Data Pointer
+
  0005e824: 08017a13 j 0x0005e84c                      {{f/jump|<nowiki>jump after sections (no Ability CT)</nowiki>}}
  0005e854: 00002821 addu r5,r0,r0 r5 = 0 (Status Set 1)
+
  0005e828: 34110004 ori r17,r0,0x0004                |{{f/std|<nowiki>r17 = 0x04 (Jump flag in status set 1)</nowiki>}}
  0005e858: 322600ff andi r6,r17,0x00ff r6 = Statuses to Enable
+
   
  0005e85c: 0c0179b3 jal 0x 0005e6cc [[Inflicted_Status_Changes]]
+
                                            {{f/com|<nowiki>-- Defending Input Value = 0x07 --</nowiki>}}
0005e860: 00003821 addu r7,r0,r0 r7 = 0 (Enable Statuses)
+
0005e82c: 34110002 ori r17,r0,0x0002                |{{f/std|<nowiki>r17 = 0x02 (Defending flag in status set 1)</nowiki>}}
  0005e864: 02402021 addu r4,r18,r0 r4 = Unit's Data Pointer
+
  0005e830: 08017a12 j 0x0005e848                      {{f/jump|<nowiki>jump after sections (store 0x0ff as Ability CT)</nowiki>}}
  0005e868: 00002821 addu r5,r0,r0 r5 = 0 (Status Set 1)
+
  0005e834: 340200ff ori r2,r0,0x00ff                  |{{f/std|<nowiki>CT = 0x0ff</nowiki>}}
  0005e86c: 320600ff andi r6,r16,0x00ff r6 = Statuses to Disable
+
   
  0005e870: 0c0179b3 jal 0x 0005e6cc [[Inflicted_Status_Changes]]
+
                                            {{f/com|<nowiki>-- Performing Input Value = 0x08 --</nowiki>}}
  0005e874: 34070001 ori r7,r0,0x0001 r7 = 1 (Disable Statuses)
+
  0005e838: 0c0179de jal 0x0005e778                    |{{f/jal|Transfer_Last_Ability_Used_CT|<nowiki>Transfer_Last_Ability_Used_CT</nowiki>}}
  0005e878: 34110008 ori r17,r0,0x0008 Status Check = 8
+
  0005e83c: 02402021 addu r4,r18,r0                    |{{f/adr|<nowiki>r4 = Acting Unit's Data Pointer</nowiki>}}
0005e87c: 92420058 lbu r2,0x0058(r18) Load Unit's Current Statuses
+
  0005e840: 9242018b lbu r2,0x018b(r18)                |{{f/load|<nowiki>Load Acting Unit's Last Used Ability CT</nowiki>}}
  0005e880: 3410 0005 ori r16,r0,0x 0005 Counter = 5
+
  0005e844: 34110001 ori r17,r0,0x0001                |{{f/std|<nowiki>r17 = 1 (Performing flag in status set 1)</nowiki>}}
  0005e884: 02821026 xor r2,r20,r2
+
  0005e848: a242015d sb r2,0x015d(r18)                 |{{f/store|<nowiki>Store Unit's Ability CT</nowiki>}}
  0005e888: 00409021 addu r18,r2,r0 r18 = Statuses that were removed
+
   
0005e88c: 02511024 and r2,r18,r17
+
                                            {{f/com|<nowiki>-- Default  (or Input Value = 0x01 / 0x02 / 0x03 / 0x04 or invalid) - (not seen anywhere) --</nowiki>}}
  0005e890: 10400008 beq r2,r0,0x 0005e8b4 Branch if the status wasn't removed
+
  0005e84c: 3a30000f xori r16,r17,0x000f      |{{f/std|<nowiki>r16 = everything but the Status flag from above section</nowiki>}}
  0005e894: 02911024 and r2,r20,r17
+
  0005e850: 02402021 addu r4,r18,r0          |{{f/std|<nowiki>r4 = Acting unit's data pointer</nowiki>}}
  0005e898: 10400003 beq r2,r0,0x 0005e8a8 Branch if the original statuses didn't have the status
+
  0005e854: 00002821 addu r5,r0,r0           |{{f/std|<nowiki>r5 = 0 (Status Set 1 for routine below)</nowiki>}}
  0005e89c: 02002021 addu r4,r16,r0 r4 = Counter
+
  0005e858: 322600ff andi r6,r17,0x00ff      |{{f/std|<nowiki>r6 = Status flag from above section</nowiki>}}
  0005e8a0: 08017a2b j 0x 0005e8ac
+
  0005e85c: 0c0179b3 jal 0x0005e6cc          |{{f/jal|Inflicted_Status_Changes|<nowiki>Inflicted_Status_Changes</nowiki>}} Add status r17 in Unit inflicted (0x1bb) and current (0x58) status
0005e8a4: 00002821 addu r5,r0,r0 r5 = 0 (Status Removed)
+
  0005e860: 00003821 addu r7,r0,r0            |{{f/std|<nowiki>r7 = 0 (Enable Statuses)</nowiki>}}
0005e8a8: 34050001 ori r5,r0,0x0001 r5 = 1 (Status added)
+
  0005e864: 02402021 addu r4,r18,r0          |{{f/std|<nowiki>r4 = Unit's Data Pointer</nowiki>}}
  0005e8ac: 0c063a6f jal 0x0018e9bc [[Determine_if_Status_Flags_can_be_Enabled]] - Status Change Updating (duplicated ?)
+
  0005e868: 00002821 addu r5,r0,r0            |{{f/std|<nowiki>r5 = 0 (Status Set 1)</nowiki>}}
  0005e8b0: 02603021 addu r6,r19,r0 r6 = Unit's ID
+
  0005e86c: 320600ff andi r6,r16,0x00ff      |{{f/std|<nowiki>r6 = Statuses to Disable</nowiki>}}
  0005e8b4: 26100001 addiu r16,r16,0x0001 Counter ++
+
  0005e870: 0c0179b3 jal 0x0005e6cc          |{{f/jal|Inflicted_Status_Changes|<nowiki>Inflicted_Status_Changes</nowiki>}} Remove every status but r17 in Unit inflicted (0x1bb) and current (0x58) status
  0005e8b8: 2a020009 slti r2,r16,0x0009
+
  0005e874: 34070001 ori r7,r0,0x0001        |{{f/std|<nowiki>r7 = 1 (Disable Statuses)</nowiki>}}
0005e8bc: 1440fff3 bne r2,r0,0x 0005e88c Branch if Counter < 9
+
  0005e878: 34110008 ori r17,r0,0x0008        |{{f/std|<nowiki>Status Check = 0x08</nowiki>}}
  0005e8c0: 00118842 srl r17,r17,0x01 Move to next status check
+
0005e87c: 92420058 lbu r2,0x0058(r18)      |{{f/load|<nowiki>r2 = Acting Unit's Current Statuses</nowiki>}}
  0005e8c4: 8fbf0024 lw r31,0x0024(r29)
+
0005e880: 34100005 ori r16,r0,0x0005        |{{f/std|<nowiki>r16 = 0x05</nowiki>}}
0005e8c8: 8fb40020 lw r20,0x0020(r29)
+
0005e884: 02821026 xor r2,r20,r2            |{{f/std|<nowiki>r2 = Difference between Current status at the start of the routine and now (= Added/removed status)</nowiki>}}
  0005e8cc: 8fb3001c lw r19,0x001c(r29)
+
0005e888: 00409021 addu r18,r2,r0          |{{f/std|<nowiki>r18 = Statuses that were added or removed</nowiki>}}
  0005e8d0: 8fb20018 lw r18,0x0018(r29)
+
0005e88c: 02511024 and r2,r18,r17          {{f/bloop|<nowiki>LOOP</nowiki>}} {{f/std|<nowiki>r2 <> 0x00 if this iteration status was added/removed (charging(0x08), then jumping (0x04), defending, performing)</nowiki>}}
  0005e8d4: 8fb10014 lw r17,0x0014(r29)
+
0005e890: 10400008 beq r2,r0,0x0005e8b4          {{f/Cond|<nowiki>if Performing has been updtaed</nowiki>}} /Else go to next iteration
  0005e8d8: 8fb00010 lw r16,0x0010(r29)
+
0005e894: 02911024 and r2,r20,r17                    |{{f/std|<nowiki>r2 = this iteration status was present at the start of the routine (so it has been removed now)</nowiki>}}
  0005e8dc: 27bd0028 addiu r29,r29,0x0028
+
0005e898: 10400003 beq r2,r0,0x0005e8a8              {{f/Cond|<nowiki>If This iteration status has been removed</nowiki>}}
  0005e8e0: 03e00008 jr r31
+
0005e89c: 02002021 addu r4,r16,r0                    |{{f/std|<nowiki>r4 = Counter (0x05 to 0x08)</nowiki>}}
  0005e8e4: 00000000 nop
+
0005e8a0: 08017a2b j 0x0005e8ac                          {{f/jump|<nowiki>jump to next jal routine with r5 = 0x00</nowiki>}}
 +
0005e8a4: 00002821 addu r5,r0,r0                        |{{f/std|<nowiki>r5 = 0 (Status Removed)</nowiki>}}
 +
0005e8a8: 34050001 ori r5,r0,0x0001                  {{f/Cond|<nowiki>Else (status  added)</nowiki>}} {{f/std|<nowiki>r5 = 1 (Status added)</nowiki>}}
 +
0005e8ac: 0c063a6f jal 0x0018e9bc                    |{{f/jal|Determine_if_Status_Flags_can_be_Enabled|<nowiki>Determine_if_Status_Flags_can_be_Enabled</nowiki>}} Update Acting unit misc 0x148 0x14C 0x150 0x154
 +
0005e8b0: 02603021 addu r6,r19,r0                    |{{f/std|<nowiki>r6 = Acting unit's raw ID</nowiki>}}
 +
0005e8b4: 26100001 addiu r16,r16,0x0001          |{{f/std|<nowiki>r16 = loop counter + 1</nowiki>}}
 +
0005e8b8: 2a020009 slti r2,r16,0x0009            |{{f/std|<nowiki>r2 = 0x01 while counter < 0x09</nowiki>}}
 +
0005e8bc: 1440fff3 bne r2,r0,0x0005e88c    {{f/eloop|<nowiki>loop while counter < 0x09 (4 iterations)</nowiki>}}
 +
0005e8c0: 00118842 srl r17,r17,0x01              |{{f/std|<nowiki>r17 = 0x04, then 0x02, then 0x01</nowiki>}}
 +
0005e8c4: 8fbf0024 lw r31,0x0024(r29)           
 +
0005e8c8: 8fb40020 lw r20,0x0020(r29)           
 +
0005e8cc: 8fb3001c lw r19,0x001c(r29)           
 +
0005e8d0: 8fb20018 lw r18,0x0018(r29)           
 +
0005e8d4: 8fb10014 lw r17,0x0014(r29)           
 +
0005e8d8: 8fb00010 lw r16,0x0010(r29)           
 +
0005e8dc: 27bd0028 addiu r29,r29,0x0028         
 +
0005e8e0: 03e00008 jr r31                       
 +
0005e8e4: 00000000 nop                          
 +
=== Return locations ===
 +
'''Battle.bin'''
 +
0017c78c: [[Attack_Preparation]]                    r5 = 0x06 (jump section)
 +
0017c8d4: [[Attack_Preparation]]                    r5 = 0x05 or 0x08
 +
0017da6c: [[Ability_Usage_Checks_and_MP_Reduction]]  r5 = 0xff 
 +
00180220: [[Disable_acting_statuses]]                r5 = 0x00
 +
00183df0: [[Enable/disable_acting_status]]          r5 = 0x00
 +
00183e28: [[Another_intermediate_routine]]          r5 = 0x07

Latest revision as of 01:18, 29 October 2024

Parameters : r4 = Acting unit's data pointer
             r5 = Input value (*4 to determine offset in 0x80059830 table)

Will update Acting's unit's 0x1bb (infilcted status set 1) and 0x58 (current status set 1)
If r5 = 0x00 : remove everything
   r5 = 0x05 : inflict charging, remove everything else
   r5 = 0x06 : inflict jump, remove everything else
   r5 = 0x07 : inflict defending, remove everything else
   r5 = 0x08 : inflict performing, remove everything else
   r5 = 0xff : if r4 unit is performing act like r5 = 0x08, else r5 = 0x00
If r5 = 0x00 0x07 or 0x08  Update r4's 0x015d (Ability CT) with 0x0ff or last used ability CT
-------------------------------------------------------------------------------------------------
0005e7a8: 27bdffd8 addiu r29,r29,-0x0028                     
0005e7ac: afb20018 sw r18,0x0018(r29)                        
0005e7b0: 00809021 addu r18,r4,r0           |r18 = Acting Unit's Data Pointer
0005e7b4: 30a300ff andi r3,r5,0x00ff        |r3 = Input Value
0005e7b8: 340200ff ori r2,r0,0x00ff         |r2 = 0x0ff
0005e7bc: afbf0024 sw r31,0x0024(r29)       |
0005e7c0: afb40020 sw r20,0x0020(r29)       |
0005e7c4: afb3001c sw r19,0x001c(r29)       |
0005e7c8: afb10014 sw r17,0x0014(r29)       |
0005e7cc: afb00010 sw r16,0x0010(r29)       |
0005e7d0: 92540058 lbu r20,0x0058(r18)      |r20 = Acting unit's current status (0x58)
0005e7d4: 9253018a lbu r19,0x018a(r18)      |r19 = Acting unit raw ID (0x18a)
0005e7d8: 14620005 bne r3,r2,0x0005e7f0     #If Input Value = 0x0ff
0005e7dc: 2c620009 sltiu r2,r3,0x0009       |r2 = 0x01 if Input Value < 0x09
0005e7e0: 32820001 andi r2,r20,0x0001            |r2 = 0x01 if Acting unit is performing / Else 0x00
0005e7e4: 000228c0 sll r5,r2,0x03                |r5 = 0x08 if Acting unit is performing / Else 0x00
0005e7e8: 30a300ff andi r3,r5,0x00ff             |r3 = Force Input Value to be  0x08 if Unit is performing else 0x00
0005e7ec: 2c620009 sltiu r2,r3,0x0009            |r2 = 0x01 if Input Value < 0x09
0005e7f0: 10400016 beq r2,r0,0x0005e84c     #If Input Value < 0x08
0005e7f4: 00031080 sll r2,r3,0x02                |r2 = Input Value * 4
0005e7f8: 3c018006 lui r1,0x8006                 |
0005e7fc: 00220821 addu r1,r1,r2                 |
0005e800: 8c229830 lw r2,-0x67d0(r1)             |r2 = Jump Adress from Input Value  0x80059830
0005e804: 00000000 nop                           |
0005e808: 00400008 jr r2                         >>jump to section
0005e80c: 00000000 nop                           |

                                            -- Normal Action Input Value = 0x00 --
0005e810: 00008821 addu r17,r0,r0                    |r17 = 0x00 (no status)
0005e814: 08017a12 j 0x0005e848                      >>jump after sections (store 0x0ff as Ability CT)
0005e818: 340200ff ori r2,r0,0x00ff                  |r2 = 0x0ff

                                            -- Charging Input Value = 0x05 --
0005e81c: 08017a13 j 0x0005e84c                      >>jump after sections (no Ability CT)
0005e820: 34110008 ori r17,r0,0x0008                 |r17  =0x08 (Charge flag in status set 1)

                                            -- Jump Input Value = 0x06 --
0005e824: 08017a13 j 0x0005e84c                      >>jump after sections (no Ability CT)
0005e828: 34110004 ori r17,r0,0x0004                 |r17 = 0x04 (Jump flag in status set 1)

                                            -- Defending Input Value = 0x07 --
0005e82c: 34110002 ori r17,r0,0x0002                 |r17 = 0x02 (Defending flag in status set 1)
0005e830: 08017a12 j 0x0005e848                      >>jump after sections (store 0x0ff as Ability CT)
0005e834: 340200ff ori r2,r0,0x00ff                  |CT = 0x0ff

                                            -- Performing Input Value = 0x08 --
0005e838: 0c0179de jal 0x0005e778                    |-->Transfer_Last_Ability_Used_CT
0005e83c: 02402021 addu r4,r18,r0                    |r4 = Acting Unit's Data Pointer
0005e840: 9242018b lbu r2,0x018b(r18)                |Load Acting Unit's Last Used Ability CT
0005e844: 34110001 ori r17,r0,0x0001                 |r17 = 1 (Performing flag in status set 1)
0005e848: a242015d sb r2,0x015d(r18)                 |Store Unit's Ability CT

                                            -- Default  (or Input Value = 0x01 / 0x02 / 0x03 / 0x04 or invalid) - (not seen anywhere) --
0005e84c: 3a30000f xori r16,r17,0x000f      |r16 = everything but the Status flag from above section
0005e850: 02402021 addu r4,r18,r0           |r4 = Acting unit's data pointer
0005e854: 00002821 addu r5,r0,r0            |r5 = 0 (Status Set 1 for routine below)
0005e858: 322600ff andi r6,r17,0x00ff       |r6 = Status flag from above section
0005e85c: 0c0179b3 jal 0x0005e6cc           |-->Inflicted_Status_Changes Add status r17 in Unit inflicted (0x1bb) and current (0x58) status
0005e860: 00003821 addu r7,r0,r0            |r7 = 0 (Enable Statuses)
0005e864: 02402021 addu r4,r18,r0           |r4 = Unit's Data Pointer
0005e868: 00002821 addu r5,r0,r0            |r5 = 0 (Status Set 1)
0005e86c: 320600ff andi r6,r16,0x00ff       |r6 = Statuses to Disable
0005e870: 0c0179b3 jal 0x0005e6cc           |-->Inflicted_Status_Changes Remove every status but r17 in Unit inflicted (0x1bb) and current (0x58) status 
0005e874: 34070001 ori r7,r0,0x0001         |r7 = 1 (Disable Statuses)
0005e878: 34110008 ori r17,r0,0x0008        |Status Check = 0x08
0005e87c: 92420058 lbu r2,0x0058(r18)       |r2 = Acting Unit's Current Statuses
0005e880: 34100005 ori r16,r0,0x0005        |r16 = 0x05
0005e884: 02821026 xor r2,r20,r2            |r2 = Difference between Current status at the start of the routine and now (= Added/removed status)
0005e888: 00409021 addu r18,r2,r0           |r18 = Statuses that were added or removed
0005e88c: 02511024 and r2,r18,r17           @LOOP r2 <> 0x00 if this iteration status was added/removed (charging(0x08), then jumping (0x04), defending, performing)
0005e890: 10400008 beq r2,r0,0x0005e8b4          #if Performing has been updtaed /Else go to next iteration
0005e894: 02911024 and r2,r20,r17                    |r2 = this iteration status was present at the start of the routine (so it has been removed now)
0005e898: 10400003 beq r2,r0,0x0005e8a8              #If This iteration status has been removed
0005e89c: 02002021 addu r4,r16,r0                    |r4 = Counter (0x05 to 0x08)
0005e8a0: 08017a2b j 0x0005e8ac                          >>jump to next jal routine with r5 = 0x00
0005e8a4: 00002821 addu r5,r0,r0                         |r5 = 0 (Status Removed)
0005e8a8: 34050001 ori r5,r0,0x0001                  #Else (status  added) r5 = 1 (Status added)
0005e8ac: 0c063a6f jal 0x0018e9bc                    |-->Determine_if_Status_Flags_can_be_Enabled Update Acting unit misc 0x148 0x14C 0x150 0x154
0005e8b0: 02603021 addu r6,r19,r0                    |r6 = Acting unit's raw ID
0005e8b4: 26100001 addiu r16,r16,0x0001          |r16 = loop counter + 1
0005e8b8: 2a020009 slti r2,r16,0x0009            |r2 = 0x01 while counter < 0x09
0005e8bc: 1440fff3 bne r2,r0,0x0005e88c     Λ loop while counter < 0x09 (4 iterations)
0005e8c0: 00118842 srl r17,r17,0x01              |r17 = 0x04, then 0x02, then 0x01
0005e8c4: 8fbf0024 lw r31,0x0024(r29)            
0005e8c8: 8fb40020 lw r20,0x0020(r29)            
0005e8cc: 8fb3001c lw r19,0x001c(r29)            
0005e8d0: 8fb20018 lw r18,0x0018(r29)            
0005e8d4: 8fb10014 lw r17,0x0014(r29)            
0005e8d8: 8fb00010 lw r16,0x0010(r29)            
0005e8dc: 27bd0028 addiu r29,r29,0x0028          
0005e8e0: 03e00008 jr r31                        
0005e8e4: 00000000 nop                           

Return locations

Battle.bin
0017c78c: Attack_Preparation                     r5 = 0x06 (jump section)
0017c8d4: Attack_Preparation                     r5 = 0x05	or 0x08
0017da6c: Ability_Usage_Checks_and_MP_Reduction  r5 = 0xff  
00180220: Disable_acting_statuses                r5 = 0x00	
00183df0: Enable/disable_acting_status           r5 = 0x00	
00183e28: Another_intermediate_routine           r5 = 0x07