Difference between revisions of "Pre Formula Setup (FDC)"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
m
m (→‎Instructions and notes: Added note about repurposing Inflict Status byte)
 
(11 intermediate revisions by one other user not shown)
Line 1: Line 1:
  Pre Formula Setup (FDC)  [[#PFSShort|Short Summary]] // [[#PFSLong|Long Summary]]
+
__NOTOC__
 +
===Instructions and notes===
 +
  Pre Formula Setup (FDC)  [[#PFSShort|Summary]]  
 
  -------------------------------------
 
  -------------------------------------
  r4 = Attacker data pointer / r5 Defender ID
+
  r4 = Attacker current action data pointer / r5 Defender ID
  returns r2 = 0x00
+
  Returns r2 = 0x01 if ability missed before formula jump (reflect, blade graps arrow guard)
 +
        r2 = 0x00 if it jump to formula routines
 
  -------------------------------------
 
  -------------------------------------
  0018b34c: 27bdffc8 addiu r29,r29,0xffc8
+
  0018b34c: 27bdffc8 addiu r29,r29,0xffc8   |
  0018b350: afb00028 sw r16,0x0028(r29)
+
  0018b350: afb00028 sw r16,0x0028(r29)       |
  0018b354: 00a08021 addu r16,r5,r0       r16 = Target ID
+
  0018b354: 00a08021 addu r16,r5,r0           |{{f/std|<nowiki>r16 = Target ID </nowiki>}}
  0018b358: 27a50010 addiu r5,r29,0x0010   r5 = Stack + 0x10
+
  0018b358: 27a50010 addiu r5,r29,0x0010     |
  0018b35c: afbf0034 sw r31,0x0034(r29)
+
  0018b35c: afbf0034 sw r31,0x0034(r29)       |
  0018b360: afb20030 sw r18,0x0030(r29)
+
  0018b360: afb20030 sw r18,0x0030(r29)       |
  0018b364: 0c01788b jal 0x0005e22c         --> [[Copy_Byte_Data_(20_Bytes)]] (from r4 to r5)
+
  0018b364: 0c01788b jal 0x0005e22c           |{{f/jal| Copy_Byte_Data_(20_Bytes)|<nowiki> Copy_Byte_Data_(20_Bytes)</nowiki>}} (from r4 to r5 : copy attacker action data on stack)
  0018b368: afb1002c sw r17,0x002c(r29)
+
  0018b368: afb1002c sw r17,0x002c(r29)       |
  0018b36c: 3c018019 lui r1,0x8019  
+
  0018b36c: 3c018019 lui r1,0x8019           |
  0018b370: a03038c1 sb r16,0x38c1(r1)     Store ID of the defending unit (Current ability data)
+
  0018b370: a03038c1 sb r16,0x38c1(r1)       |{{f/store|<nowiki>Store ID of the defending unit (Current ability data 0x801938c1 )</nowiki>}}
  0018b374: 321000ff andi r16,r16,0x00ff   r16 = Last byte of Target ID
+
  0018b374: 321000ff andi r16,r16,0x00ff     |{{f/std|<nowiki>r16 = Last byte of Target ID</nowiki>}}
  0018b378: 001010c0 sll r2,r16,0x03       r2 = Defender ID * 0x8
+
  0018b378: 001010c0 sll r2,r16,0x03         |{{f/std|<nowiki>r2 = Defender ID * 0x8</nowiki>}}
  0018b37c: 00501023 subu r2,r2,r16       r2 = defender ID * 0x7
+
  0018b37c: 00501023 subu r2,r2,r16           |{{f/std|<nowiki>r2 = defender ID * 0x7</nowiki>}}
  0018b380: 00021180 sll r2,r2,0x06       r2 = defender ID * 0x1c0
+
  0018b380: 00021180 sll r2,r2,0x06           |{{f/std|<nowiki>r2 = defender ID * 0x1c0</nowiki>}}
  0018b384: 3c048019 lui r4,0x8019
+
  0018b384: 3c048019 lui r4,0x8019           |
  0018b388: 248408cc addiu r4,r4,0x08cc   r4 = Start of Unit Data
+
  0018b388: 248408cc addiu r4,r4,0x08cc       |{{f/std|<nowiki>r4 = Start of Unit Data</nowiki>}}
  0018b38c: 00441821 addu r3,r2,r4         r3 = Defender data location(start of unit data + Defender battle ID * 0x1c0)
+
  0018b38c: 00441821 addu r3,r2,r4           |{{f/std|<nowiki>r3 = Defender data location(start of unit data + Defender battle ID * 0x1c0)</nowiki>}}
  0018b390: 3c018019 lui r1,0x8019
+
  0018b390: 3c018019 lui r1,0x8019           |
  0018b394: ac232d98 sw r3,0x2d98(r1)     Store Defender's Data Location (Current action data)
+
  0018b394: ac232d98 sw r3,0x2d98(r1)         |{{f/store|<nowiki>Store Defender's Data Location (Current action data 0x80192d98)</nowiki>}}
  0018b398: 2483018c addiu r3,r4,0x018c   r3 = Start of unit data + 0x018c (current action data)
+
  0018b398: 2483018c addiu r3,r4,0x018c       |{{f/std|<nowiki>r3 = Start of unit data + 0x018c (current action data)</nowiki>}}
  0018b39c: 00431021 addu r2,r2,r3         r2 = Current action data + 0x01c0 (Defender current action data)
+
  0018b39c: 00431021 addu r2,r2,r3           |{{f/std|<nowiki>r2 = Current action data + 0x01c0 (Defender current action data)</nowiki>}}
  0018b3a0: 93a30010 lbu r3,0x0010(r29)   r3 = Load attackers unit ID from stack (from routine 0x0005e22c)
+
  0018b3a0: 93a30010 lbu r3,0x0010(r29)       |{{f/load|<nowiki>r3 = Load attackers unit ID from stack (from routine 0x0005e22c)</nowiki>}}
  0018b3a4: 3c018019 lui r1,0x8019
+
  0018b3a4: 3c018019 lui r1,0x8019           |
  0018b3a8: ac222d90 sw r2,0x2d90(r1)     Store Defender's Current Action Data (Current action data)
+
  0018b3a8: ac222d90 sw r2,0x2d90(r1)         |{{f/store|<nowiki>Store Defender's Current Action Data (Current action data 0x80192d90 )</nowiki>}}
  0018b3ac: 3c028019 lui r2,0x8019
+
  0018b3ac: 3c028019 lui r2,0x8019           |
  0018b3b0: 244238c0 addiu r2,r2,0x38c0   r2 = Load Attacker's Unit ID location
+
  0018b3b0: 244238c0 addiu r2,r2,0x38c0       |{{f/std|<nowiki>r2 = Load Attacker's Unit ID location</nowiki>}}
  0018b3b4: 3c018019 lui r1,0x8019
+
  0018b3b4: 3c018019 lui r1,0x8019           |
  0018b3b8: a020390e sb r0,0x390e(r1)     Store formula as 0x00
+
  0018b3b8: a020390e sb r0,0x390e(r1)         |{{f/store|<nowiki>set post formula flag to  0x00 at 0x8019390e</nowiki>}}
  0018b3bc: a0430000 sb r3,0x0000(r2)     Store ID of the attacking unit (Current Ability data)
+
  0018b3bc: a0430000 sb r3,0x0000(r2)         |{{f/store|<nowiki>Store ID of the attacking unit (Current Ability data 0x801938c0 )</nowiki>}}
  0018b3c0: 90430000 lbu r3,0x0000(r2)     r3 = Load ID of the attacking unit (really?)
+
  0018b3c0: 90430000 lbu r3,0x0000(r2)       |{{f/load|<nowiki>r3 = Load ID of the attacking unit</nowiki>}}
  0018b3c4: 3c028019 lui r2,0x8019
+
  0018b3c4: 3c028019 lui r2,0x8019           |
  0018b3c8: 24422da0 addiu r2,r2,0x2da0   r2 = 0x80192da0 (copy of attacker action data?)
+
  0018b3c8: 24422da0 addiu r2,r2,0x2da0       |{{f/std|<nowiki>r2 = 0x80192da0 (copy of attacker action data?)</nowiki>}}
  0018b3cc: 3c018019 lui r1,0x8019
+
  0018b3cc: 3c018019 lui r1,0x8019           |
  0018b3d0: ac222d8c sw r2,0x2d8c(r1)     Store 0x80192da0 into attacker current action data location (current action data)
+
  0018b3d0: ac222d8c sw r2,0x2d8c(r1)         |{{f/store|<nowiki>Store "0x80192da0" into attacker current action data location (current action data 0x80192d8c)</nowiki>}}
  0018b3d4: 000310c0 sll r2,r3,0x03       r2 = attacking Unit ID * 0x8
+
  0018b3d4: 000310c0 sll r2,r3,0x03           |{{f/std|<nowiki>r2 = Attacking unit ID * 8</nowiki>}}
  0018b3d8: 00431023 subu r2,r2,r3         r2 = Attacking unit ID * 0x7
+
  0018b3d8: 00431023 subu r2,r2,r3           |{{f/std|<nowiki>r2 = Attacking unit ID * 7</nowiki>}}
  0018b3dc: 00021180 sll r2,r2,0x06       r2 = Attacking unit ID * 0x1c0
+
  0018b3dc: 00021180 sll r2,r2,0x06           |{{f/std|<nowiki>r2 = Attacking unit ID * 448 (0x1c0)</nowiki>}}
  0018b3e0: 3c038019 lui r3,0x8019
+
  0018b3e0: 3c038019 lui r3,0x8019           |
  0018b3e4: 8c63f5f0 lw r3,-0x0a10(r3)     r3 = Loads type of action (word / reacting - pre attack - attack)
+
  0018b3e4: 8c63f5f0 lw r3,-0x0a10(r3)       |{{f/load|<nowiki>r3 = Loads type of action (word / reacting - pre attack - attack) from 0x8018f5f0</nowiki>}} {{f/std|<nowiki>8018F5F0</nowiki>}}
  0018b3e8: 00441021 addu r2,r2,r4         r2 = Attacker data location
+
  0018b3e8: 00441021 addu r2,r2,r4           |{{f/std|<nowiki>r2 = Attacker data location (r4 = start of units data + r2 Attacker ID * 448)</nowiki>}}
0018b3ec: 3c018019 lui r1,0x8019
+
0018b3ec: 3c018019 lui r1,0x8019           |
  0018b3f0: ac222d94 sw r2,0x2d94(r1)     Store Attacker's Data location (Current action data)
+
  0018b3f0: ac222d94 sw r2,0x2d94(r1)         |{{f/store|<nowiki>Store Attacker's Data location (Current action data 0x80192d94)</nowiki>}}
  0018b3f4: 10600009 beq r3,r0,0x0018b41c # If reacting (Branch if attack is initial or preview)
+
  0018b3f4: 10600009 beq r3,r0,0x0018b41c     {{f/Cond|<nowiki> If reacting</nowiki>}} /Branch if attack is initial or preview
  0018b3f8: 00000000 nop                       |
+
  0018b3f8: 00000000 nop                           |{{f/std|<nowiki> </nowiki>}}
  0018b3fc: 0c062bcb jal 0x0018af2c           |--> [[Perform_reaction_abilities]] return r2 =0x01 if ok 0xffff if reaction is not tested and 0x00 if reflect with reaction flag 0x01 alone.
+
  0018b3fc: 0c062bcb jal 0x0018af2c               |{{f/jal| Perform_reaction_abilities |<nowiki> Perform_reaction_abilities </nowiki>}} {{f/std|<nowiki> r2 = 0x01 for non counter post action abilities ? /  -0x01 for guard skills/ 0x00 for counter abilities, hamedo and auto-potion (?)</nowiki>}}
  0018b400: 00000000 nop                       |
+
  0018b400: 00000000 nop                           |{{f/std|<nowiki>Notes : if r2 = 0x01 Current action data are edited</nowiki>}}
  0018b404: 10400005 beq r2,r0,0x0018b41c     #If Reaction OK (Branch if Reaction failed)
+
  0018b404: 10400005 beq r2,r0,0x0018b41c         {{f/Cond|<nowiki>If Reaction ability is not a counter one</nowiki>}}
  0018b408: 00000000 nop                           |
+
  0018b408: 00000000 nop                               |{{f/std|<nowiki> </nowiki>}}
  0018b40c: 0c062c9d jal 0x0018b274               |--> [[Store_used_weapon]] (modified by action menu ID)
+
  0018b40c: 0c062c9d jal 0x0018b274                   |{{f/jal| Store_used_weapon |<nowiki> Store_used_weapon </nowiki>}} {{f/std|<nowiki>(modified by action menu ID)</nowiki>}}
  0018b410: 27a40010 addiu r4,r29,0x0010           |makes r4 a stack pointer for above
+
  0018b410: 27a40010 addiu r4,r29,0x0010               |{{f/std|<nowiki>makes r4 a stack pointer for above jal</nowiki>}}
  0018b414: 08062e77 j 0x0018b9dc                 X> Goto End
+
  0018b414: 08062e77 j 0x0018b9dc                     {{f/jump|<nowiki> Jump to </nowiki>{{f/loc|<nowiki>End</nowiki>}}<nowiki></nowiki>}}
  0018b418: 00001021 addu r2,r0,r0                 |r2 = 0
+
  0018b418: 00001021 addu r2,r0,r0                     |{{f/std|<nowiki>r2 = 0x00</nowiki>}}
  0018b41c: 3c028019 lui r2,0x8019         EE# Not reacting/Reacting and r2 = 0x00 (reflect with flag 0x01 alone)
+
  0018b41c: 3c028019 lui r2,0x8019           {{f/Cond|<nowiki>E </nowiki>}} {{f/Cond|<nowiki>E </nowiki>}} '''Not reacting or reaction is a counter ability'''
  0018b420: 904238ed lbu r2,0x38ed(r2)     r2 = Load can poach/post action byte // Fall damage ?
+
  0018b420: 904238ed lbu r2,0x38ed(r2)       |{{f/load|<nowiki>r2 = Can poach/post action byte // Fall damage ?</nowiki>}}
  0018b424: 00000000 nop                  
+
  0018b424: 00000000 nop                     |
  0018b428: 30420080 andi r2,r2,0x0080     r2 = 0x0080 if attack is fall damage / Else = 0x000 (0x80 is flagged as fall dmg not calculated ?)
+
  0018b428: 30420080 andi r2,r2,0x0080       |{{f/std|<nowiki>r2 = 0x0080 if attack is fall damage / Else = 0x000 (0x80 is flagged as fall dmg not calculated ?)</nowiki>}}
  0018b42c: 10400005 beq r2,r0,0x0018b444 #If attack is fall Dmg / Branch if attack is not fall damage
+
  0018b42c: 10400005 beq r2,r0,0x0018b444     {{f/Cond|<nowiki>If attack is fall Dmg </nowiki>}} /Else branch
  0018b430: 00000000 nop                       |
+
  0018b430: 00000000 nop                           |{{f/std|<nowiki> </nowiki>}}
  0018b434: 0c062b8f jal 0x0018ae3c           |--> [[Knockback%3F]] - Fall Damage
+
  0018b434: 0c062b8f jal 0x0018ae3c               |{{f/jal| Knockback%3F|<nowiki> Knockback%3F</nowiki>}} Set Fall Damage
  0018b438: 00000000 nop                       |
+
  0018b438: 00000000 nop                           |
  0018b43c: 08062e77 j 0x0018b9dc             X> Goto end
+
  0018b43c: 08062e77 j 0x0018b9dc                 {{f/jump|<nowiki> Jump to </nowiki>{{f/loc|<nowiki>End</nowiki>}}<nowiki></nowiki>}}
  0018b440: 00001021 addu r2,r0,r0             |r2 = 0x00
+
  0018b440: 00001021 addu r2,r0,r0                 |{{f/std|<nowiki>r2 = 0x00</nowiki>}}
  0018b444: 3c048019 lui r4,0x8019         E# Attack is not fall dmg
+
  0018b444: 3c048019 lui r4,0x8019           {{f/Cond|<nowiki>Else  - Attack is not fall dmg</nowiki>}}
  0018b448: 8c842d98 lw r4,0x2d98(r4)     r4 = Defender's Data Pointer
+
  0018b448: 8c842d98 lw r4,0x2d98(r4)         |{{f/adr|<nowiki>r4 = Target Data Pointer</nowiki>}}
  0018b44c: 0c060428 jal 0x001810a0       --> [[Map_Location_Calculation]] - Return r2 as Target tile ID
+
  0018b44c: 0c060428 jal 0x001810a0           |{{f/jal| Map_Location_Calculation|<nowiki> Map_Location_Calculation</nowiki>}}  Return r2 as Target tile ID
  0018b450: 00000000 nop
+
  0018b450: 00000000 nop                     |
  0018b454: 000210c0 sll r2,r2,0x03       r2 = Target tile ID x 8
+
  0018b454: 000210c0 sll r2,r2,0x03           |{{f/std|<nowiki>r2 = Target tile ID x 8</nowiki>}}
  0018b458: 3c018019 lui r1,0x8019        
+
  0018b458: 3c018019 lui r1,0x8019           |
  0018b45c: 00220821 addu r1,r1,r2         r1 = 8019 + Tile ID x 8
+
  0018b45c: 00220821 addu r1,r1,r2           |{{f/std|<nowiki>r1 = 8019 + Tile ID x 8</nowiki>}}
  0018b460: 9022f8cc lbu r2,-0x0734(r1)   r2 = Target Tile Type
+
  0018b460: 9022f8cc lbu r2,-0x0734(r1)       |{{f/load|<nowiki>r2 = Target Tile Type </nowiki>}} {{f/load|<nowiki>(from 0x8018f8cc + tile ID offset)</nowiki>}}
  0018b464: 3c038019 lui r3,0x8019
+
  0018b464: 3c038019 lui r3,0x8019           |
  0018b468: 906338c3 lbu r3,0x38c3(r3)     r3 = Strike counter (previous info Weapon Hand (0 = R, 1 = L) ?)
+
  0018b468: 906338c3 lbu r3,0x38c3(r3)       |{{f/load|<nowiki>r3 = Strike counter </nowiki>}} {{f/load|<nowiki>(previous info Weapon Hand (0 = R, 1 = L) ?)</nowiki>}}
  0018b46c: 3042003f andi r2,r2,0x003f     r2 = Filter out Target tile terrain type
+
  0018b46c: 3042003f andi r2,r2,0x003f       |{{f/std|<nowiki>r2 = Filter out Target tile terrain type</nowiki>}}
  0018b470: 3c018019 lui r1,0x8019
+
  0018b470: 3c018019 lui r1,0x8019           |
  0018b474: a02238cd sb r2,0x38cd(r1)     Store defender terrain type (flagged as caster tile ID in data table ?)
+
  0018b474: a02238cd sb r2,0x38cd(r1)         |{{f/store|<nowiki>Store defender terrain type at current ability 0x801938cd</nowiki>}} {{f/store|<nowiki> (flagged as caster tile ID in data table ?)</nowiki>}}
  0018b478: 14600005 bne r3,r0,0x0018b490 #If 1rst strike /// Weapon is in right hand / Branch if Weapon is in left hand
+
  0018b478: 14600005 bne r3,r0,0x0018b490     {{f/Cond|<nowiki>If 1rst strike </nowiki>}} /Else branch
  0018b47c: 00000000 nop                       |
+
  0018b47c: 00000000 nop                           |{{f/std|<nowiki> </nowiki>}}
  0018b480: 3c078019 lui r7,0x8019             |
+
  0018b480: 3c078019 lui r7,0x8019                 |{{f/std|<nowiki> </nowiki>}}
  0018b484: 90e738c4 lbu r7,0x38c4(r7)         |r7 = Right Arm Equip ID
+
  0018b484: 90e738c4 lbu r7,0x38c4(r7)             |{{f/load|<nowiki>r7 = Current ability Primary weapon ID</nowiki>}}
  0018b488: 08062d26 j 0x0018b498             > Jump after left hand section
+
  0018b488: 08062d26 j 0x0018b498                 {{f/jump|<nowiki> Jump after not first strike section</nowiki>}}
  0018b48c: 00000000 nop
+
  0018b48c: 00000000 nop                           |
  0018b490: 3c078019 lui r7,0x8019         E# Not first strike ///(Weapon in left hand ?)
+
  0018b490: 3c078019 lui r7,0x8019           {{f/Cond|<nowiki>Else -  Not first strike</nowiki>}}
  0018b494: 90e738c5 lbu r7,0x38c5(r7)         |r7 = Left Arm Equip ID
+
  0018b494: 90e738c5 lbu r7,0x38c5(r7)             |{{f/load|<nowiki>r7 = Current ability secondary weapon ID</nowiki>}}
  0018b498: 93a30011 lbu r3,0x0011(r29)   r3 =  Last skillset used ///equipment ID type
+
  0018b498: 93a30011 lbu r3,0x0011(r29)       |{{f/load|<nowiki>r3 =  Attacker Last skillset used </nowiki>}}
  0018b49c: 34020013 ori r2,r0,0x0013     r2 = 0x13  Draw out ?
+
  0018b49c: 34020013 ori r2,r0,0x0013         |{{f/std|<nowiki>r2 = 0x13  (= Draw out ID)</nowiki>}}
  0018b4a0: 14620004 bne r3,r2,0x0018b4b4 # If Draw Out (Else Branch) // Branch if weapon is not a shield
+
  0018b4a0: 14620004 bne r3,r2,0x0018b4b4     {{f/Cond|<nowiki> If Draw Out</nowiki>}}
  0018b4a4: 30e200ff andi r2,r7,0x00ff     r2 = Right or Left Hand Item (depend of mini section above)
+
  0018b4a4: 30e200ff andi r2,r7,0x00ff       |{{f/std|<nowiki>r2 = r7 (primary or secondary weapon ID)</nowiki>}}
  0018b4a8: 93a70018 lbu r7,0x0018(r29)       |r7 = Used item/Equip ID ?
+
  0018b4a8: 93a70018 lbu r7,0x0018(r29)           |{{f/load|<nowiki>r7 = Attacker Used item/Equip ID (from Attacker 0x176)</nowiki>}}
  0018b4ac: 00000000 nop                       |
+
  0018b4ac: 00000000 nop                           |
  0018b4b0: 30e200ff andi r2,r7,0x00ff         |r2 = Used item
+
  0018b4b0: 30e200ff andi r2,r7,0x00ff             |{{f/std|<nowiki>r2 = Used item</nowiki>}}
  0018b4b4: 2c420080 sltiu r2,r2,0x0080   r2 = 0x01 if weapon/Ninja throwed / 0x00 if shield (0x80 = first shield)
+
  0018b4b4: 2c420080 sltiu r2,r2,0x0080       |{{f/std|<nowiki>r2 = 0x01 if the item is a weapon (ID < 0x80) - Else 0x00 (not a weapon)</nowiki>}}
  0018b4b8: 14400002 bne r2,r0,0x0018b4c4 #If Weapon/item used is not a weapon ///If weapon actually is a shield, branch
+
  0018b4b8: 14400002 bne r2,r0,0x0018b4c4     {{f/Cond|<nowiki>If Equiped/used item is not a weapon</nowiki>}}
  0018b4bc: 00000000 nop                       |
+
  0018b4bc: 00000000 nop                           |{{f/std|<nowiki> </nowiki>}}
  0018b4c0: 00003821 addu r7,r0,r0             |r7 = 0x00 ///If equipment was a shield, Weapon ID = 0
+
  0018b4c0: 00003821 addu r7,r0,r0                 |{{f/std|<nowiki>r7 = 0x00</nowiki>}}
  0018b4c4: 97a30012 lhu r3,0x0012(r29)   r3 = Last attack used
+
  0018b4c4: 97a30012 lhu r3,0x0012(r29)       |{{f/load|<nowiki>r3 = Attacker Last attack/ability used (attacker 0x170)</nowiki>}}
  0018b4c8: 3c108019 lui r16,0x8019      
+
  0018b4c8: 3c108019 lui r16,0x8019           |
  0018b4cc: 261038d8 addiu r16,r16,0x38d8 r16 = 0x801938d8 - weapon ID data location /// =Load Spell Proc Ability ID
+
  0018b4cc: 261038d8 addiu r16,r16,0x38d8     |{{f/std|<nowiki>r16 = 0x801938d8 - current ability weapon ID adress</nowiki>}}
  0018b4d0: a2070000 sb r7,0x0000(r16)     Store used Weapon ID (0x00 if not a weapon)
+
  0018b4d0: a2070000 sb r7,0x0000(r16)       |{{f/store|<nowiki>Store Attacker used/equiped Weapon ID (0x00 if not a weapon) </nowiki>}}  at current ability  0x801938d8
  0018b4d4: 3c018019 lui r1,0x8019        
+
  0018b4d4: 3c018019 lui r1,0x8019           |
  0018b4d8: a42338d6 sh r3,0x38d6(r1)     Store Used Ability/Attack ID
+
  0018b4d8: a42338d6 sh r3,0x38d6(r1)         |{{f/store|<nowiki>Store Attacker used Ability/Attack ID</nowiki>}}  at current ability  0x801938d6
  0018b4dc: 3c028019 lui r2,0x8019
+
  0018b4dc: 3c028019 lui r2,0x8019           |
  0018b4e0: 944238d6 lhu r2,0x38d6(r2)     Load Used Ability ID (pointless and sucky)
+
  0018b4e0: 944238d6 lhu r2,0x38d6(r2)       |{{f/load|<nowiki>Load current ability Used Ability ID</nowiki>}}
  0018b4e4: 3c018019 lui r1,0x8019
+
  0018b4e4: 3c018019 lui r1,0x8019           |
  0018b4e8: a02038d9 sb r0,0x38d9(r1)     Store Two Hands as inactive (?)
+
  0018b4e8: a02038d9 sb r0,0x38d9(r1)         |{{f/store|<nowiki>Store Two Hands as inactive (?)</nowiki>}}
  0018b4ec: 2c420171 sltiu r2,r2,0x0171   r2 = 0x01 if Ability <= Potion (why potion is keeped) / Else 0x00 (R-S-M)
+
  0018b4ec: 2c420171 sltiu r2,r2,0x0171       |{{f/std|<nowiki>r2 = 0x01 if used ability is before Hi-potion</nowiki>}}
  0018b4f0: 14400002 bne r2,r0,0x0018b4fc # If Ability ID >= Hi-Potion (go get ability pointer)
+
  0018b4f0: 14400002 bne r2,r0,0x0018b4fc     {{f/Cond|<nowiki> If Ability ID >= Hi-Potion </nowiki>}}
  0018b4f4: 26050018 addiu r5,r16,0x0018   |r5 = 0x801938F0 - Current Ability Range data location
+
  0018b4f4: 26050018 addiu r5,r16,0x0018     |{{f/std|<nowiki>r5 = 0x801938F0 - Current Ability Range data location</nowiki>}}
  0018b4f8: 00001821 addu r3,r0,r0     |r3 = 0x00 /// load the pointer of first attack
+
  0018b4f8: 00001821 addu r3,r0,r0                 |{{f/std|<nowiki>r3 = 0x00 (used ability ID = 0x00)</nowiki>}}
  0018b4fc: 000320c0 sll r4,r3,0x03       r4 = Used Ability ID * 8 (0x00 if >= Hi potion)
+
  0018b4fc: 000320c0 sll r4,r3,0x03           |{{f/std|<nowiki>r4 = Used Ability ID * 8 </nowiki>}}
  0018b500: 00832023 subu r4,r4,r3         r4 = Used Ability ID * 7
+
  0018b500: 00832023 subu r4,r4,r3           |{{f/std|<nowiki>r4 = Used Ability ID * 7</nowiki>}}
  0018b504: 00042040 sll r4,r4,0x01       r4 = Used Ability ID * 14 (if ability ID >= Hi potion, r4 = 0x00)
+
  0018b504: 00042040 sll r4,r4,0x01           |{{f/std|<nowiki>r4 = Used Ability ID * 14 (if ability ID >= Hi potion, r4 = 0x00)</nowiki>}}
  0018b508: 3c028006 lui r2,0x8006
+
  0018b508: 3c028006 lui r2,0x8006           |
  0018b50c: 2442fbf0 addiu r2,r2,0xfbf0    r2 = Start of Abilities data 2
+
  0018b50c: 2442fbf0 addiu r2,r2,-0x410      |{{f/std|<nowiki>r2 = Start of Abilities data 2</nowiki>}}
  0018b510: 00822021 addu r4,r4,r2         r4 = Start of Used Ability (by ID) Data 2
+
  0018b510: 00822021 addu r4,r4,r2           |{{f/std|<nowiki>r4 = Start of Used Ability (by ID) Data 2</nowiki>}}
  0018b514: 3406000e ori r6,r0,0x000e     r6 = 0x0e (for next jal)
+
  0018b514: 3406000e ori r6,r0,0x000e         |{{f/std|<nowiki>r6 = 0x0e (for next jal)</nowiki>}}
  0018b518: 30e200ff andi r2,r7,0x00ff     r2 = Weapon ID  
+
  0018b518: 30e200ff andi r2,r7,0x00ff       |{{f/std|<nowiki>r2 = Equiped/Used Weapon ID (0x00 if not a weapon)</nowiki>}}
  0018b51c: 000210c0 sll r2,r2,0x03       r2 = Weapon ID * 8
+
  0018b51c: 000210c0 sll r2,r2,0x03           |{{f/std|<nowiki>r2 = Weapon ID * 8</nowiki>}}
  0018b520: 3c038006 lui r3,0x8006
+
  0018b520: 3c038006 lui r3,0x8006           |
  0018b524: 24633ab8 addiu r3,r3,0x3ab8   r3 = Start of weapons data 2  
+
  0018b524: 24633ab8 addiu r3,r3,0x3ab8       |{{f/std|<nowiki>r3 = Start of weapons data 2 </nowiki>}}
  0018b528: 0c017895 jal 0x0005e254       --> [[Store_X_Byte_into_Y]] - Store used ability data 2 into current ability data section (r5) - 0x0e bytes (from r6)
+
  0018b528: 0c017895 jal 0x0005e254           |{{f/jal| Store_X_Byte_into_Y|<nowiki> Store_X_Byte_into_Y</nowiki>}}  - Store used ability data 2 into current ability data section (r5) from 0x801938f0 to 0x801938fd  (If > Hi-potion all fields are set to 0x00)
  0018b52c: 00438821 addu r17,r2,r3       r17 = Start of Used weapon Data 2  
+
  0018b52c: 00438821 addu r17,r2,r3           |{{f/std|<nowiki>r17 = Start of Used weapon Data 2 </nowiki>}}
  0018b530: 02202021 addu r4,r17,r0       r4 = r17 (preparing next jal)
+
  0018b530: 02202021 addu r4,r17,r0           |{{f/std|<nowiki>r4 = r17 (preparing next jal)</nowiki>}}
  0018b534: 26050026 addiu r5,r16,0x0026   r5 = 0x801938FE (start of weapon section in current ability section)
+
  0018b534: 26050026 addiu r5,r16,0x0026     |{{f/std|<nowiki>r5 = 0x801938FE (start of weapon section in current ability section)</nowiki>}}
  0018b538: 0c017895 jal 0x0005e254 --> [[Store_X_Byte_into_Y]] - Store used weapon data into weapon's current ability data section - 0x08 bytes
+
  0018b538: 0c017895 jal 0x0005e254           |{{f/jal|  Store_X_Byte_into_Y|<nowiki> Store_X_Byte_into_Y</nowiki>}} - Store equiped/used weapon data into weapon's current ability data section (from 0x801938fe to 0x80193905) (data from item 0x00 if not a weapon)
  0018b53c: 34060008 ori r6,r0,0x0008     r6 = 0x08
+
  0018b53c: 34060008 ori r6,r0,0x0008         |{{f/std|<nowiki>r6 = 0x08</nowiki>}}
  0018b540: 92240007 lbu r4,0x0007(r17)   r4 = Inflict Status/Cast Spell ID from Weapon
+
  0018b540: 92240007 lbu r4,0x0007(r17)       |{{f/load|<nowiki>r4 = Inflict Status/Cast Spell ID from used Weapon data</nowiki>}}
  0018b544: 3c038019 lui r3,0x8019
+
  0018b544: 3c038019 lui r3,0x8019           |
  0018b548: 8c632d94 lw r3,0x2d94(r3)     r3 = Attacker Data location
+
  0018b548: 8c632d94 lw r3,0x2d94(r3)         |{{f/adr|<nowiki>r3 = Attacker Data location</nowiki>}}
  0018b54c: 34020001 ori r2,r0,0x0001     r2 = 1
+
  0018b54c: 34020001 ori r2,r0,0x0001         |{{f/std|<nowiki>r2 = 1</nowiki>}}
  0018b550: 3c018019 lui r1,0x8019
+
  0018b550: 3c018019 lui r1,0x8019           |
  0018b554: a02038e4 sb r0,0x38e4(r1)     Store Charge Power as 0?
+
  0018b554: a02038e4 sb r0,0x38e4(r1)         |{{f/store|<nowiki>Store current ability Charge Power to 0</nowiki>}}  at 0x801938e4
  0018b558: 3c018019 lui r1,0x8019
+
  0018b558: 3c018019 lui r1,0x8019           |
  0018b55c: a02238e5 sb r2,0x38e5(r1)     Store Ability Formula as 0x01 ?
+
  0018b55c: a02238e5 sb r2,0x38e5(r1)         |{{f/store|<nowiki>Store current ability Formula as 0x01 </nowiki>}} at 0x801938e5
  0018b560: 3c018019 lui r1,0x8019
+
  0018b560: 3c018019 lui r1,0x8019           |
  0018b564: a02438da sb r4,0x38da(r1)     Store r4 (Inflict Status/Cast Spell ID from Weapon) in current ability data proc ID
+
  0018b564: a02438da sb r4,0x38da(r1)         |{{f/store|<nowiki>Store Weapon's proc ID in current ability data proc ID</nowiki>}} at 801938da
  0018b568: 90620026 lbu r2,0x0026(r3)     r2 =  Attacker's Faith
+
  0018b568: 90620026 lbu r2,0x0026(r3)       |{{f/load|<nowiki>r2 =  Attacker's Faith</nowiki>}}
  0018b56c: 3c038019 lui r3,0x8019
+
  0018b56c: 3c038019 lui r3,0x8019           |
  0018b570: 8c632d98 lw r3,0x2d98(r3)     r3 =  Defender Data location
+
  0018b570: 8c632d98 lw r3,0x2d98(r3)         |{{f/adr|<nowiki>r3 =  Defender Data location</nowiki>}}
  0018b574: 3c018019 lui r1,0x8019
+
  0018b574: 3c018019 lui r1,0x8019           |
  0018b578: a02238d3 sb r2,0x38d3(r1) Store Attacker's Faith in current data section (without faith/innocent check)
+
  0018b578: a02238d3 sb r2,0x38d3(r1)         |{{f/store|<nowiki> Store Attacker's Faith in current data section (without faith/innocent check)</nowiki>}}  at 0x801938d3
  0018b57c: 90620026 lbu r2,0x0026(r3)     r2 = Defender's Faith
+
  0018b57c: 90620026 lbu r2,0x0026(r3)       |{{f/load|<nowiki>r2 = Defender's Faith</nowiki>}}
  0018b580: 3c018019 lui r1,0x8019
+
  0018b580: 3c018019 lui r1,0x8019           |
  0018b584: a02238d2 sb r2,0x38d2(r1)     Store Defender's Faith in current data section (without faith/innocent check)
+
  0018b584: a02238d2 sb r2,0x38d2(r1)         |{{f/store|<nowiki>Store Defender's Faith in current data section (without faith/innocent check)</nowiki>}}  at 0x801938d2
  0018b588: 0c062b7d jal 0x0018adf4       --> [[Action_data_nulling]] (nullify most of current TCAD and ACAP data / set hit% at 100%  - Hit flag at 0x01 for target, at 0x00 for attacker)
+
  0018b588: 0c062b7d jal 0x0018adf4           |{{f/jal| Action_data_nulling|<nowiki> Action_data_nulling</nowiki>}}  (nullify most of current TCAD and ACAP data / set hit% at 100%  - Hit flag at 0x01 for target, at 0x00 for attacker)
  0018b58c: 00000000 nop
+
  0018b58c: 00000000 nop                     |
  0018b590: 93a20011 lbu r2,0x0011(r29)   r2 = Attacker last skill used
+
  0018b590: 93a20011 lbu r2,0x0011(r29)       |{{f/load|<nowiki>r2 = Attacker last used skillset (Attacker 0x16f)</nowiki>}}
0018b594: 3c038019 lui r3,0x8019
+
0018b594: 3c038019 lui r3,0x8019           |
  0018b598: 946338c8 lhu r3,0x38c8(r3)     r3 = ?? /// 0x1 if spell proc is true, and 0x0 otherwise
+
  0018b598: 946338c8 lhu r3,0x38c8(r3)       |{{f/load|<nowiki>r3 = ?? </nowiki>}}  set to 0x00 if elemental nullification, to 0x01 if reaction/proc (maybe host something like"reactable" action)
  0018b59c: 3c018019 lui r1,0x8019
+
  0018b59c: 3c018019 lui r1,0x8019           |
  0018b5a0: a02238d4 sb r2,0x38d4(r1)     Store r2 (Attacker used skillset) in current ability data used ability skillset
+
  0018b5a0: a02238d4 sb r2,0x38d4(r1)         |{{f/store|<nowiki>Store r2 in current ability data last used skillset</nowiki>}}  at 0x801938d4
  0018b5a4: 304200ff andi r2,r2,0x00ff   r2 = last byte of Attacker last used skillset (no change ?)
+
  0018b5a4: 304200ff andi r2,r2,0x00ff       |
  0018b5a8: 3c018006 lui r1,0x8006
+
  0018b5a8: 3c018006 lui r1,0x8006           |
  0018b5ac: 00220821 addu r1,r1,r2         r1 = 0x800600XX (XX = last used skill set)
+
  0018b5ac: 00220821 addu r1,r1,r2           |{{f/std|<nowiki>r1 = 0x800600XX (XX = last used skill set)</nowiki>}}
  0018b5b0: 90325cb4 lbu r18,0x5cb4(r1)   r18 = Action Menu of used skillset
+
  0018b5b0: 90325cb4 lbu r18,0x5cb4(r1)       |{{f/load|<nowiki>r18 = Action Menu of used skillset</nowiki>}}
  0018b5b4: 10600009 beq r3,r0,0x0018b5dc  #If r3 <> 0 Reaction ? /// Branch if Weapon Proc failed
+
  0018b5b4: 10600009 beq r3,r0,0x0018b5dc     {{f/Cond|<nowiki>If 0x801938c8 <> 0x00 (Reaction ? Proc ?)</nowiki>}} {{f/std|<nowiki>Will switch Ability ID with reaction ID (0x801938c6)</nowiki>}}
  0018b5b8: 00000000 nop                       |
+
  0018b5b8: 00000000 nop                           |{{f/std|<nowiki> </nowiki>}}
  0018b5bc: 3c028019 lui r2,0x8019             |
+
  0018b5bc: 3c028019 lui r2,0x8019                 |{{f/std|<nowiki> </nowiki>}}
  0018b5c0: 944238c6 lhu r2,0x38c6(r2)         |r2 = current ability reaction byte /// Load ??? (reaction ID? this halfword seems to handle all post-attack results...)
+
  0018b5c0: 944238c6 lhu r2,0x38c6(r2)             |{{f/load|<nowiki>r2 = current ability reaction byte </nowiki>}} Load (reaction ID? this halfword seems to handle all post-attack results...)
  0018b5c4: 00000000 nop                       |     
+
  0018b5c4: 00000000 nop                           |{{f/std|<nowiki>     </nowiki>}}
  0018b5c8: a7a20012 sh r2,0x0012(r29)         |Store r2 as used ability ID on stack  (see first jal) /// If Spell proc is true, store proc ID as used ability ID (temporary)
+
  0018b5c8: a7a20012 sh r2,0x0012(r29)             |{{f/store|<nowiki>Store Reaction ID as Attacker used ability ID on stack  </nowiki>}}
  0018b5cc: 3c018019 lui r1,0x8019             |
+
  0018b5cc: 3c018019 lui r1,0x8019                 |
  0018b5d0: a42238d6 sh r2,0x38d6(r1)         |Store r2 as used current ability used ability ID Spell Proc ID as Used Ability ID
+
  0018b5d0: a42238d6 sh r2,0x38d6(r1)             |{{f/store|<nowiki>Store Reaction ID as current ability used ability ID (Proc ? Reaction ?)</nowiki>}}
  0018b5d4: 08062d79 j 0x0018b5e4             |
+
  0018b5d4: 08062d79 j 0x0018b5e4                 {{f/jump|<nowiki>jump after Else</nowiki>}}
  0018b5d8: 00009021 addu r18,r0,r0           |r18 = 0x00 - Clear Action Menu ID
+
  0018b5d8: 00009021 addu r18,r0,r0               |{{f/std|<nowiki>r18 = 0x00 - Clear Action Menu ID to default</nowiki>}}
  0018b5dc: 3c018019 lui r1,0x8019        
+
  0018b5dc: 3c018019 lui r1,0x8019           {{f/Cond|<nowiki>Else</nowiki>}}
0018b5e0: a42038c6 sh r0,0x38c6(r1)     Set current ability Reaction ID to 0x00 /// Store ??? as 0x00 (reaction ID?)
+
0018b5e0: a42038c6 sh r0,0x38c6(r1)             |{{f/store|<nowiki>Set current ability Reaction ID to 0x00 </nowiki>}}
  0018b5e4: 87a30012 lh r3,0x0012(r29)     r3 = Attack used ability ID
+
  0018b5e4: 87a30012 lh r3,0x0012(r29)       |{{f/load|<nowiki>r3 =attacker used ability ID</nowiki>}} {{f/std|<nowiki> (attacker 0x170 if not modified above)</nowiki>}}
  0018b5e8: 3c028006 lui r2,0x8006
+
  0018b5e8: 3c028006 lui r2,0x8006           |
  0018b5ec: 2442ebf0 addiu r2,r2,0xebf0   r2 = Start of abilities data 1
+
  0018b5ec: 2442ebf0 addiu r2,r2,0xebf0       |{{f/std|<nowiki>r2 = Start of abilities data 1</nowiki>}}
  0018b5f0: 000318c0 sll r3,r3,0x03       r3 = r3 * 8 (ability ID * 8)
+
  0018b5f0: 000318c0 sll r3,r3,0x03           |{{f/std|<nowiki>r3 = r3 * 8 (ability ID * 8)</nowiki>}}
  0018b5f4: 00621821 addu r3,r3,r2         r3 = Ability (by ID) start of data 1  
+
  0018b5f4: 00621821 addu r3,r3,r2           |{{f/std|<nowiki>r3 = Ability (by ID) start of data 1 </nowiki>}}
  0018b5f8: 90620004 lbu r2,0x0004(r3)     r2 = First set of AI Flags
+
  0018b5f8: 90620004 lbu r2,0x0004(r3)       |{{f/load|<nowiki>r2 = used ability First set of AI Flags</nowiki>}}
  0018b5fc: 3c048019 lui r4,0x8019
+
  0018b5fc: 3c048019 lui r4,0x8019           |
  0018b600: 8c842d90 lw r4,0x2d90(r4)     r4 = TCADP
+
  0018b600: 8c842d90 lw r4,0x2d90(r4)         |{{f/adr|<nowiki>r4 = Target current action data pointer</nowiki>}}
  0018b604: 30420003 andi r2,r2,0x0003     r2 = focus on target allies or target ennemies flags
+
  0018b604: 30420003 andi r2,r2,0x0003       |{{f/std|<nowiki>r2 = focus on target allies or target ennemies flags</nowiki>}}
  0018b608: a0820018 sb r2,0x0018(r4)     Store Abilities AI Target Enemies/Allies into 0x18 of Current Action Data (positive spells 'miss,' negative spells are 'guarded'!)
+
  0018b608: a0820018 sb r2,0x0018(r4)         |{{f/store|<nowiki>Store Abilities AI Target Enemies/Allies into 0x18 of Current Action Data</nowiki>}} {{f/store|<nowiki>(positive spells 'miss,' negative spells are 'guarded'!)</nowiki>}}
  0018b60c: 90620007 lbu r2,0x0007(r3)     r2 = evade with motion byte
+
  0018b60c: 90620007 lbu r2,0x0007(r3)       |{{f/load|<nowiki>r2 = Used ability evade with motion byte</nowiki>}}
  0018b610: 00000000 nop
+
  0018b610: 00000000 nop                     |
  0018b614: 30420001 andi r2,r2,0x0001     r2 = 0x01 if evade with motion is checked - else 0x00
+
  0018b614: 30420001 andi r2,r2,0x0001       |{{f/std|<nowiki>r2 = 0x01 if evade with motion is checked - else 0x00</nowiki>}}
  0018b618: 10400009 beq r2,r0,0x0018b640 # If Evade with motion is checked /// Branch if ability does not evade with motion
+
  0018b618: 10400009 beq r2,r0,0x0018b640     {{f/Cond|<nowiki> If Evade with motion is checked </nowiki>}}
  0018b61c: 324300ff andi r3,r18,0x00ff   |r3 = Action Menu ID
+
  0018b61c: 324300ff andi r3,r18,0x00ff       |{{f/std|<nowiki>r3 = Action Menu ID</nowiki>}}
  0018b620: 3c038019 lui r3,0x8019             |    
+
  0018b620: 3c038019 lui r3,0x8019                 |{{f/std|<nowiki>      </nowiki>}}
  0018b624: 8c632d90 lw r3,0x2d90(r3)         |r3 = TCADP
+
  0018b624: 8c632d90 lw r3,0x2d90(r3)             |{{f/adr|<nowiki>r3 = Target current action data pointer</nowiki>}}
  0018b628: 00000000 nop                       |
+
  0018b628: 00000000 nop                           |
  0018b62c: 90620018 lbu r2,0x0018(r3)         |r2 = 'missed' or 'guarded' byte (positive attack vs negative attack)
+
  0018b62c: 90620018 lbu r2,0x0018(r3)             |{{f/load|<nowiki>r2 = TCADP 0x18</nowiki>}} {{f/load|<nowiki> & 'missed' or 'guarded' byte (positive attack vs negative attack)</nowiki>}}
  0018b630: 00000000 nop                       |
+
  0018b630: 00000000 nop                           |
  0018b634: 24420080 addiu r2,r2,0x0080       |update r2 with animate miss checked
+
  0018b634: 24420080 addiu r2,r2,0x0080           |{{f/std|<nowiki>update r2 with 0x80 if evade with motion is checked</nowiki>}}
  0018b638: a0620018 sb r2,0x0018(r3)         |store updated byte
+
  0018b638: a0620018 sb r2,0x0018(r3)             |{{f/store|<nowiki>store updated byte in Target current action 0x18</nowiki>}}
  0018b63c: 324300ff andi r3,r18,0x00ff       |r3 = Action Menu ID
+
  0018b63c: 324300ff andi r3,r18,0x00ff           |{{f/std|<nowiki>r3 = Action Menu ID</nowiki>}}
  0018b640: 34020007 ori r2,r0,0x0007     r2 = 0x07
+
  0018b640: 34020007 ori r2,r0,0x0007         |{{f/std|<nowiki>r2 = 0x07</nowiki>}}
  0018b644: 14620006 bne r3,r2,0x0018b660 #if action menu = katana inventory ///Branch if Action Menu ID != Draw Out
+
  0018b644: 14620006 bne r3,r2,0x0018b660     {{f/Cond|<nowiki>if action menu = katana inventory </nowiki>}}
  0018b648: 2c62000b sltiu r2,r3,0x000b   |r2 = 0x01 if action menu < 0x0b (is not Defend or Equip Change or blank or unknow
+
  0018b648: 2c62000b sltiu r2,r3,0x000b       |{{f/std|<nowiki>r2 = 0x01 if action menu < 0x0b (is not Defend or Equip Change or blank or unknow</nowiki>}}
  0018b64c: 93a20018 lbu r2,0x0018(r29)       |r2 = Attacker used Item ID (on stack)
+
  0018b64c: 93a20018 lbu r2,0x0018(r29)           |{{f/load|<nowiki>r2 = Attacker used Item ID (Attacker 0x0176)</nowiki>}}
  0018b650: 00000000 nop       |
+
  0018b650: 00000000 nop                           |
  0018b654: 24420026 addiu r2,r2,0x0026       |r2 = Item ID +0x26  (the displacement of katana from their associated abilities)
+
  0018b654: 24420026 addiu r2,r2,0x0026           |{{f/std|<nowiki>r2 = Item ID +0x26  (the displacement of katana ID  from their associated abilities ID)</nowiki>}}
  0018b658: a7a20012 sh r2,0x0012(r29)         |Store r2 as attacker used ability ID (on stack)
+
  0018b658: a7a20012 sh r2,0x0012(r29)             |{{f/store|<nowiki>Store r2 as attacker used ability ID (on stack)</nowiki>}}
  0018b65c: 2c62000b sltiu r2,r3,0x000b       |r2 = 0x01 if action menu < 0x0b (is not Defend or Equip Change or blank or unknow
+
  0018b65c: 2c62000b sltiu r2,r3,0x000b           |{{f/std|<nowiki>r2 = 0x01 if action menu < 0x0b (is not Defend or Equip Change or blank or unknow</nowiki>}}
  0018b660: 10400095 beq r2,r0,0x0018b8b8 #If action menu is not defend / equip change / blank  /// if Action Menu Type is defend or equip change; weapon formula = 0x01
+
  0018b660: 10400095 beq r2,r0,0x0018b8b8     {{f/Cond|<nowiki>If action menu is not defend / equip change / blank  </nowiki>}} /Else jump to dedicated section
  0018b664: 00031080 sll r2,r3,0x02           |r2 = action menu * 4 (word)
+
  0018b664: 00031080 sll r2,r3,0x02               |{{f/std|<nowiki>r2 = action menu * 4 (word)</nowiki>}}
  0018b668: 3c018017 lui r1,0x8017  
+
  0018b668: 3c018017 lui r1,0x8017                 |
  0018b66c: 00220821 addu r1,r1,r2             |r1 = 8017XXXX (XXXX = action menu * 4)
+
  0018b66c: 00220821 addu r1,r1,r2                 |{{f/std|<nowiki>r1 = 8017XXXX (XXXX = action menu * 4)</nowiki>}}
  0018b670: 8c224344 lw r2,0x4344(r1)         |Load return addresses for action menu (AM)
+
  0018b670: 8c224344 lw r2,0x4344(r1)             |{{f/adr|<nowiki>Load jump addresses for action menu (AM)</nowiki>}} /[[Action_menu_return_address_(pre_formula_set_up)]]
Default: 0x8018b694
+
  0018b674: 00000000 nop                          |
Item  : 0x8018b76c - AM : Item inventory
+
  0018b678: 00400008 jr r2                        {{f/jump|<nowiki>jump to location specified by the above table</nowiki>}}
Throw : 0x8018b7d4 - AM : Weapon inventory
+
  0018b67c: 00000000 nop                           |
Math  : 0x8018b694  - AM : Mathematics
 
Geo    : 0x8018b680  - AM : Elements
 
blank  : 0x8018b8b8 
 
Monster: 0x8018b694  - AM : Monsters
 
Katana : 0x8018b694  - AM : Katana inventory
 
Attack : 0x8018b818  - AM : Attack
 
Jump  : 0x8018b7dc  - AM : Jump
 
Charge : 0x8018b7e4  - AM : Aim
 
    -Menus past this point are ignored by the above branch, and likely just jump to garbage data. they are included regardless as a warning
 
Defend : 0x27bdffe8
 
Equip  : 0xafbf0010
 
Unknown: 0x0c063998
 
Blank  : 0x00000000
 
Unknown: 0x00401821
 
0018b674: 00000000 nop                       |
 
0018b678: 00400008 jr r2                    |jump to location specified by the above table
 
0018b67c: 00000000 nop
 
 
   
 
   
Geomancy section
+
                                            {{f/com|--GEOMANCY SECTION--}}
  0018b680: 3c048019 lui r4,0x8019
+
  0018b680: 3c048019 lui r4,0x8019                 |
  0018b684: 8c842d94 lw r4,0x2d94(r4)         |r4 =  Attacker Data pointer
+
  0018b684: 8c842d94 lw r4,0x2d94(r4)             |{{f/adr|<nowiki>r4 =  Attacker Data pointer</nowiki>}}
  0018b688: 0c05fcb6 jal 0x0017f2d8           --> [[Get_Elemental_Ability_ID]] ELEMENTAL terrain to skill hard-coding
+
  0018b688: 0c05fcb6 jal 0x0017f2d8               |{{f/jal| Get_Elemental_Ability_ID|<nowiki> Get_Elemental_Ability_ID</nowiki>}} Attacker Tile ID to geomancy skill hard-coding (return r2 = Ability ID)
  0018b68c: 00000000 nop                       |
+
  0018b68c: 00000000 nop                           |
  0018b690: a7a20012 sh r2,0x0012(r29)         |Store r2 On temp stack as last attack used /// save ability ID to temp
+
  0018b690: a7a20012 sh r2,0x0012(r29)             |{{f/store|<nowiki>Store r2 as attacker last used ability </nowiki>}} {{f/store|<nowiki>(On stack)</nowiki>}}
 
   
 
   
Default, Math, Monster, Katana Section
+
                                            {{f/com|--DEFAULT, MATH, MONSTER, KATANA -- (And Geomancy)}}
  0018b694: 87a20012 lh r2,0x0012(r29)         |r2 = Attacker last attack used //// Load it again
+
  0018b694: 87a20012 lh r2,0x0012(r29)             |{{f/load|<nowiki>r2 = Attacker last used ability </nowiki>}}
  0018b698: 00000000 nop                       |
+
  0018b698: 00000000 nop                           |
  0018b69c: 28420171 slti r2,r2,0x0171         |r2 = 0x01 if ability <= Potion / Else 0x00  /// set true if ability ID is not hardcoded (except for potion apparently, likely a number typo in the original code)
+
  0018b69c: 28420171 slti r2,r2,0x0171             |{{f/std|<nowiki>r2 = 0x01 if ability <= Potion / Else 0x00  </nowiki>}}
  0018b6a0: 10400086 beq r2,r0,0x0018b8bc     #If Ability <= Potion /// branch if Ability ID > 171 (Hi-Potion? Not Potion?)
+
  0018b6a0: 10400086 beq r2,r0,0x0018b8bc         {{f/Cond|<nowiki>If Ability <= Potion </nowiki>}} Else branch after action menu sections (formula will be 0x01)
  0018b6a4: 34100001 ori r16,r0,0x0001            |r16 = 0x01
+
  0018b6a4: 34100001 ori r16,r0,0x0001            |{{f/std|<nowiki>r16 = 0x01 (will become formula)</nowiki>}}
 
  0018b6a8: 3c028019 lui r2,0x8019                |
 
  0018b6a8: 3c028019 lui r2,0x8019                |
  0018b6ac: 8c422d94 lw r2,0x2d94(r2               |r2 = Attacker Data Pointer
+
  0018b6ac: 8c422d94 lw r2,0x2d94(r2                   |{{f/adr|<nowiki>r2 = Attacker Data Pointer</nowiki>}}
  0018b6b0: 00000000 nop                           |
+
  0018b6b0: 00000000 nop                               |
  0018b6b4: 9042005a lbu r2,0x005a(r2)             |r2 = Attacker Third set of Current Status
+
  0018b6b4: 9042005a lbu r2,0x005a(r2)                 |{{f/load|<nowiki>r2 = Attacker Third set of Current Status</nowiki>}}
  0018b6b8: 00000000 nop                           |
+
  0018b6b8: 00000000 nop                               |
  0018b6bc: 30420002 andi r2,r2,0x0002             |r2 = 0x02 if Attacker is a Frog / Else 0x00
+
  0018b6bc: 30420002 andi r2,r2,0x0002                 |{{f/std|<nowiki>r2 = 0x02 if Attacker is a Frog / Else 0x00</nowiki>}}
  0018b6c0: 1040000d beq r2,r0,0x0018b6f8         #If Attacker is a frog (possible by monster AM ?) /// Branch if unit is not a frog (stupid check. frogs can't use geomancy :()
+
  0018b6c0: 1040000d beq r2,r0,0x0018b6f8             {{f/Cond|<nowiki>If Attacker is a frog (which Action menu ?) </nowiki>}}
  0018b6c4: 00000000 nop                               |
+
  0018b6c4: 00000000 nop                                   |{{f/std|<nowiki> </nowiki>}}
  0018b6c8: 3c058019 lui r5,0x8019                     |
+
  0018b6c8: 3c058019 lui r5,0x8019                         |{{f/std|<nowiki> </nowiki>}}
  0018b6cc: 24a538c8 addiu r5,r5,0x38c8               |r5 = 801938c8 (Current ability ? Flag - Deals with reaction ? Proc ? - to be checked)
+
  0018b6cc: 24a538c8 addiu r5,r5,0x38c8                   |{{f/std|<nowiki>r5 = 801938c8 (Current ability ? Flag - Deals with reaction ? Proc ? - to be checked)</nowiki>}}
  0018b6d0: 94a20000 lhu r2,0x0000(r5)                 |r2 = x38c8 halfW value Load Spell Proc Ability ID into r2
+
  0018b6d0: 94a20000 lhu r2,0x0000(r5)                     |{{f/load|<nowiki>r2 = halfword at 0x801938c8 (reaction ? Proc ?)</nowiki>}}
  0018b6d4: 00000000 nop                               |
+
  0018b6d4: 00000000 nop                                   |
  0018b6d8: 14400007 bne r2,r0,0x0018b6f8             #If r2= 0x00 /// Branch if spell proc/reaction is true (Frog counter attack?)
+
  0018b6d8: 14400007 bne r2,r0,0x0018b6f8                     {{f/Cond|<nowiki>If r2= 0x00 (no reaction ? Attack nullified ?)</nowiki>}}
  0018b6dc: 24a50036 addiu r5,r5,0x0036                   |0x801938c8 + 0x36 = 801938fe = current ability weapon range location
+
  0018b6dc: 24a50036 addiu r5,r5,0x0036                           |{{f/std|<nowiki>0x801938c8 + 0x36 = 801938fe = current ability weapon range location</nowiki>}}
  0018b6e0: 3c018019 lui r1,0x8019                         |
+
  0018b6e0: 3c018019 lui r1,0x8019                                 |
  0018b6e4: a02038d8 sb r0,0x38d8(r1)                     |Current ability used weapon ID = 0x00 (when frog and x38c8 = 0x00)
+
  0018b6e4: a02038d8 sb r0,0x38d8(r1)                             |{{f/store|<nowiki>Current ability used weapon ID = 0x00 (when frog and x38c8 = 0x00)</nowiki>}}
  0018b6e8: 3c048006 lui r4,0x8006                         |
+
  0018b6e8: 3c048006 lui r4,0x8006                                 |
  0018b6ec: 24843ab8 addiu r4,r4,0x3ab8                   |r4 = 0x80063ab8 = Weapons Secondary Data start
+
  0018b6ec: 24843ab8 addiu r4,r4,0x3ab8                           |{{f/std|<nowiki>r4 = 0x80063ab8 = Weapons Secondary Data start</nowiki>}}
  0018b6f0: 0c017895 jal 0x0005e254                       --> [[Store_X_Byte_into_Y]] Store data from the null weapon (fists) into 0x801938fe - 0x80193905 (current ability weapon section)
+
  0018b6f0: 0c017895 jal 0x0005e254                               |{{f/jal| Store_X_Byte_into_Y |<nowiki> Store_X_Byte_into_Y </nowiki>}}  Store data from the null weapon (fists) into 0x801938fe - 0x80193905 (current ability weapon section)
  0018b6f4: 34060008 ori r6,r0,0x0008                     |r6 = 0x08 (number of bytes stored in above jal)
+
  0018b6f4: 34060008 ori r6,r0,0x0008                             |{{f/std|<nowiki>r6 = 0x08 (for Jal above)</nowiki>}}
  0018b6f8: 3c058019 lui r5,0x8019                 |
+
  0018b6f8: 3c058019 lui r5,0x8019                     |{{f/std|<nowiki> </nowiki>}}
  0018b6fc: 24a538f0 addiu r5,r5,0x38f0           |r5 = 0x801938f0 - Current ability : ability range adress (prepare jal at 0x8018b720)
+
  0018b6fc: 24a538f0 addiu r5,r5,0x38f0               |{{f/std|<nowiki>r5 = 0x801938f0 - Current ability : ability range adress (prepare jal at 0x8018b720)</nowiki>}}
  0018b700: 87a20012 lh r2,0x0012(r29)             |r2 = Attacker last attack used (on stack)
+
  0018b700: 87a20012 lh r2,0x0012(r29)                 |{{f/load|<nowiki>r2 = Attacker last used ability (on stack)</nowiki>}}
  0018b704: 3406000e ori r6,r0,0x000e             |r6 = 0x0e (limit for 0x8018b720)
+
  0018b704: 3406000e ori r6,r0,0x000e                 |{{f/std|<nowiki>r6 = 0x0e (limit for 0x8018b720)</nowiki>}}
  0018b708: 000280c0 sll r16,r2,0x03               |r16 = r2 * 8 (Ability ID * 8)
+
  0018b708: 000280c0 sll r16,r2,0x03                   |{{f/std|<nowiki>r16 = r2 * 8 (Ability ID * 8)</nowiki>}}
  0018b70c: 02028023 subu r16,r16,r2               |r16 = ID * 7
+
  0018b70c: 02028023 subu r16,r16,r2                   |{{f/std|<nowiki>r16 = ID * 7</nowiki>}}
  0018b710: 00108040 sll r16,r16,0x01             |r16 = ID * 14
+
  0018b710: 00108040 sll r16,r16,0x01                 |{{f/std|<nowiki>r16 = ID * 14</nowiki>}}
  0018b714: 3c028006 lui r2,0x8006                 |
+
  0018b714: 3c028006 lui r2,0x8006                     |
  0018b718: 2442fbf0 addiu r2,r2,0xfbf0            |r2 = 0x8006fbf0 (start of abilities data 2)
+
  0018b718: 2442fbf0 addiu r2,r2-0x0410                |{{f/std|<nowiki>r2 = 0x8005fbf0 (start of abilities data 2)</nowiki>}}
  0018b71c: 02028021 addu r16,r16,r2               |r16 = ability data 2 location for ability ID
+
  0018b71c: 02028021 addu r16,r16,r2                   |{{f/std|<nowiki>r16 = last used ability data 2 location for ability ID</nowiki>}}
  0018b720: 0c017895 jal 0x0005e254               --> [[Store_X_Byte_into_Y]] Store ability data 2 into 0x801938f0 - 0x801938fd (current ability data section)
+
  0018b720: 0c017895 jal 0x0005e254                   |{{f/jal| Store_X_Byte_into_Y |<nowiki> Store_X_Byte_into_Y </nowiki>}} Store ability data 2 into 0x801938f0 - 0x801938fd (update for geomancy, katana and reaction)
  0018b724: 02002021 addu r4,r16,r0               |r4 = r16 (ability data 2 location for above jal )
+
  0018b724: 02002021 addu r4,r16,r0                   |{{f/std|<nowiki>r4 = r16 (ability data 2 location for above jal )</nowiki>}}
  0018b728: 9202000b lbu r2,0x000b(r16)           |r2 = Load Ability Inflict Status ID (from ability table)
+
  0018b728: 9202000b lbu r2,0x000b(r16)               |{{f/load|<nowiki>r2 = Load Ability Inflict Status ID (from ability table)</nowiki>}}
  0018b72c: 3c018019 lui r1,0x8019                 |
+
  0018b72c: 3c018019 lui r1,0x8019                     |
  0018b730: a02238da sb r2,0x38da(r1)             |Store status proc ID in current ability data section
+
  0018b730: a02238da sb r2,0x38da(r1)                 |{{f/store|<nowiki>Store status proc ID in current ability data section</nowiki>}}
  0018b734: 3c028019 lui r2,0x8019                 |
+
  0018b734: 3c028019 lui r2,0x8019                     |
  0018b738: 904238f3 lbu r2,0x38f3(r2)             |r2 = Current ability ability flag 1
+
  0018b738: 904238f3 lbu r2,0x38f3(r2)                 |{{f/load|<nowiki>r2 = Current ability ability : ability flags 1</nowiki>}}
  0018b73c: 92100008 lbu r16,0x0008(r16)           |r16 = Ability Formula (from ability table)
+
  0018b73c: 92100008 lbu r16,0x0008(r16)               |{{f/load|<nowiki>r16 = Ability Formula (from ability table)</nowiki>}}
  0018b740: 30420024 andi r2,r2,0x0024             |r2 = check result for "weapon strike" and "ranged weapon" flags
+
  0018b740: 30420024 andi r2,r2,0x0024                 |{{f/std|<nowiki>r2 = check result for "weapon strike" and "ranged weapon" flags</nowiki>}}
  0018b744: 1440005e bne r2,r0,0x0018b8c0         # If r2 = 0x00 (none of the above checked) /// Branch if Weapon Range or Weapon Strike to get formula address, using the spell's formula
+
  0018b744: 1440005e bne r2,r0,0x0018b8c0             {{f/Cond|<nowiki> If weapon strike and ranged weapon are not checked </nowiki>}}  Else branch after the action menu sections
  0018b748: 320200ff andi r2,r16,0x00ff           |r2 = Ability formula (= r16)
+
  0018b748: 320200ff andi r2,r16,0x00ff               |{{f/std|<nowiki>r2 = Ability formula (= r16)</nowiki>}}
  0018b74c: 324300ff andi r3,r18,0x00ff               |r3 = Action Menu of used skillset
+
  0018b74c: 324300ff andi r3,r18,0x00ff                   |{{f/std|<nowiki>r3 = Action Menu of used skillset</nowiki>}}
  0018b750: 34020007 ori r2,r0,0x0007                 |r2 = 0x07
+
  0018b750: 34020007 ori r2,r0,0x0007                     |{{f/std|<nowiki>r2 = 0x07</nowiki>}}
  0018b754: 1062005a beq r3,r2,0x0018b8c0             #If action menu <> Katana inventory /// Branch if Action Menu = Draw Out
+
  0018b754: 1062005a beq r3,r2,0x0018b8c0                 {{f/Cond|<nowiki>If action menu <> Katana inventory </nowiki>}}  Else branch after the action menu sections
  0018b758: 320200ff andi r2,r16,0x00ff               |r2 = Ability formula  
+
  0018b758: 320200ff andi r2,r16,0x00ff                   |{{f/std|<nowiki>r2 = Ability formula </nowiki>}}
  0018b75c: 3c018019 lui r1,0x8019                         |
+
  0018b75c: 3c018019 lui r1,0x8019                             |{{f/std|<nowiki> </nowiki>}}
  0018b760: a02038d8 sb r0,0x38d8(r1)                     |Store current ability Used Weapon ID as 0x00 (not ranged weapon - not weapon strike - not draw out)
+
  0018b760: a02038d8 sb r0,0x38d8(r1)                         |{{f/store|<nowiki>Store current ability Used Weapon ID as 0x00 (not ranged weapon - not weapon strike - not draw out)</nowiki>}}
  0018b764: 08062e2f j 0x0018b8bc                         > Jump to last section
+
  0018b764: 08062e2f j 0x0018b8bc                             {{f/jump|<nowiki> Jump after action menu section</nowiki>}}
  0018b768: 00000000 nop                           #E  #E> Jump to last section (by branch above)
+
  0018b768: 00000000 nop                                       |
 
   
 
   
Item section
+
                                            {{f/com|--ITEM---}}
  0018b76c: 93a70018 lbu r7,0x0018(r29)         |r7 = Used Item/Weapon ID  
+
  0018b76c: 93a70018 lbu r7,0x0018(r29)           |{{f/load|<nowiki>r7 = Attacker used Item/Weapon ID </nowiki>}}
  0018b770: 00000000 nop                       |
+
  0018b770: 00000000 nop                           |
  0018b774: 2ce200f0 sltiu r2,r7,0x00f0         |r2 = 0x01 if Item used is < at Potion / Else 0x00
+
  0018b774: 2ce200f0 sltiu r2,r7,0x00f0           |{{f/std|<nowiki>r2 = 0x01 if Item used is < at Potion / Else 0x00</nowiki>}}
  0018b778: 14400050 bne r2,r0,0x0018b8bc       # If r2 = 0x00 / Else branch to last section ////Branch if an item is not used for this ability
+
  0018b778: 14400050 bne r2,r0,0x0018b8bc         {{f/Cond|<nowiki> If Attacker used item ID >= Potion ID</nowiki>}} /Else branch after action menu section (with formula = 0x01)
  0018b77c: 34100001 ori r16,r0,0x0001             |r16 = 0x01
+
  0018b77c: 34100001 ori r16,r0,0x0001             |{{f/std|<nowiki>r16 = 0x01</nowiki>}}
  0018b780: 3c048019 lui r4,0x8019                 |
+
  0018b780: 3c048019 lui r4,0x8019                     |{{f/std|<nowiki> </nowiki>}}
  0018b784: 248438d8 addiu r4,r4,0x38d8             |r4 = Current ability Used Weapon ID location (0x801938d8)
+
  0018b784: 248438d8 addiu r4,r4,0x38d8               |{{f/std|<nowiki>r4 = Current ability Used Weapon ID location (0x801938d8)</nowiki>}}
  0018b788: a0870000 sb r7,0x0000(r4)               |Store used item ID in Current ability Used weapon ID
+
  0018b788: a0870000 sb r7,0x0000(r4)                 |{{f/store|<nowiki>Store used item ID in Current ability Used weapon ID</nowiki>}}
  0018b78c: 24e70010 addiu r7,r7,0x0010             |r7 = Used Item ID + 0x10
+
  0018b78c: 24e70010 addiu r7,r7,0x0010               |{{f/std|<nowiki>r7 = Used Item ID + 0x10</nowiki>}}
  0018b790: 24840018 addiu r4,r4,0x0018             |r4 = Current ability - Ability range location (0x801938f0)
+
  0018b790: 24840018 addiu r4,r4,0x0018               |{{f/std|<nowiki>r4 = Current ability - Ability range location (0x801938f0)</nowiki>}}
  0018b794: 30e200ff andi r2,r7,0x00ff             |r2 = r7 last byte (Used item ID + 0x10 : for potion F0 +0x10 = 0x100 then 0x0100 and 0x00FF = 0x00)
+
  0018b794: 30e200ff andi r2,r7,0x00ff                 |{{f/std|<nowiki>r2 = r7 last byte (Used item ID + 0x10 : for potion F0 +0x10 = 0x100 then 0x0100 and 0x00FF = 0x00)</nowiki>}}
  0018b798: 00028040 sll r16,r2,0x01               |r16 = r7*2
+
  0018b798: 00028040 sll r16,r2,0x01                   |{{f/std|<nowiki>r16 = r7*2</nowiki>}}
  0018b79c: 02028021 addu r16,r16,r2               |r16 = r7*3  / 0x00 (for potion) to 0x27 (for phoenix down)
+
  0018b79c: 02028021 addu r16,r16,r2                   |{{f/std|<nowiki>r16 = r7*3  / 0x00 (for potion) to 0x27 (for phoenix down)</nowiki>}}
  0018b7a0: 3c028006 lui r2,0x8006                 |
+
  0018b7a0: 3c028006 lui r2,0x8006                     |
  0018b7a4: 24423f98 addiu r2,r2,0x3f98             |r2 = 0x80063f98 Items Secondary Data Table
+
  0018b7a4: 24423f98 addiu r2,r2,0x3f98               |{{f/std|<nowiki>r2 = 0x80063f98 potion Secondary Data Table</nowiki>}}
  0018b7a8: 02028021 addu r16,r16,r2               |r16 = 0x80063f98 + (0x00 to 0x27) = Used item secondary table adress
+
  0018b7a8: 02028021 addu r16,r16,r2                   |{{f/std|<nowiki>r16 = 0x80063f98 + (0x00 to 0x27) = Used item secondary data table adress</nowiki>}}
  0018b7ac: 3c018019 lui r1,0x8019                 |
+
  0018b7ac: 3c018019 lui r1,0x8019                     |
  0018b7b0: a02738db sb r7,0x38db(r1)               |Store r7 last byte current ability used Item ID (0x00 to 0x13)
+
  0018b7b0: a02738db sb r7,0x38db(r1)                 |{{f/store|<nowiki>Store r7 last byte current ability used Item ID (0x00 to 0x0d)</nowiki>}}
  0018b7b4: 92020002 lbu r2,0x0002(r16)             |r2 = used Item's inflicted Status
+
  0018b7b4: 92020002 lbu r2,0x0002(r16)               |{{f/load|<nowiki>r2 = used Item's inflicted Status</nowiki>}}
  0018b7b8: 3c018019 lui r1,0x8019                 |
+
  0018b7b8: 3c018019 lui r1,0x8019                     |
  0018b7bc: a02238da sb r2,0x38da(r1)               |Store status proc of item
+
  0018b7bc: a02238da sb r2,0x38da(r1)                 |{{f/store|<nowiki>Store status proc of used item in current ability status proc</nowiki>}}
  0018b7c0: 0c017991 jal 0x0005e644                 --> [[Data_Nullifying]] nullify data from r4 (Current ability range) to r4 + r5 (0x801938e6 curent ability flags 4)
+
  0018b7c0: 0c017991 jal 0x0005e644                   |{{f/jal| Data_Nullifying |<nowiki> Data_Nullifying </nowiki>}} nullify data from r4 (Current ability range) to r4 + r5 (0x801938fd ability MP Cost)
  0018b7c4: 3405000e ori r5,r0,0x000e               |r5 = 0x0e (limit)
+
  0018b7c4: 3405000e ori r5,r0,0x000e                 |{{f/std|<nowiki>r5 = 0x0e (limit)</nowiki>}}
  0018b7c8: 92100000 lbu r16,0x0000(r16)           |r16 = used Item formula
+
  0018b7c8: 92100000 lbu r16,0x0000(r16)               |{{f/load|<nowiki>r16 = used Item formula</nowiki>}}
  0018b7cc: 08062e30 j 0x0018b8c0                   > Jump to last section /// Get formula address of item formula
+
  0018b7cc: 08062e30 j 0x0018b8c0                     {{f/jump|<nowiki>Jump after action menu sections</nowiki>}}
  0018b7d0: 320200ff andi r2,r16,0x00ff             |r2 = used Item formula
+
  0018b7d0: 320200ff andi r2,r16,0x00ff               |{{f/std|<nowiki>r2 = used Item formula</nowiki>}}
                                              #E jump to last section (by branch)
 
Throw Section
 
0018b7d4: 08062e2f j 0x0018b8bc              >Get formula address with formula = 0x63
 
0018b7d8: 34100063 ori r16,r0,0x0063   |r16 = 0x63
 
 
   
 
   
Jump Section
+
                                            {{f/com|--THROW--}}
  0018b7dc: 08062e2f j 0x0018b8bc               >Get formula address with formula = 0x64
+
  0018b7d4: 08062e2f j 0x0018b8bc                 {{f/jump|<nowiki> Jump after action menu sections with formula = 0x63</nowiki>}}
  0018b7e0: 34100064 ori r16,r0,0x0064          |r16 = 0x64
+
  0018b7d8: 34100063 ori r16,r0,0x0063            |{{f/std|<nowiki>r16 = 0x63</nowiki>}}
 
   
 
   
Charge Section
+
                                            {{f/com|--JUMP--}}
0018b7e4: 97a30012 lhu r3,0x0012(r29)        |r3 = Attacker last used attack ID /// Loads ability ID?
+
  0018b7dc: 08062e2f j 0x0018b8bc                  {{f/jump|<nowiki> Jump after action menu sections with formula = 0x64</nowiki>}}
0018b7e8: 00000000 nop                        |
+
  0018b7e0: 34100064 ori r16,r0,0x0064            |{{f/std|<nowiki>r16 = 0x64</nowiki>}}
0018b7ec: 2462fe6a addiu r2,r3,0xfe6a        |r2 = ability ID - 196  (Note : Charge+1 ID = 0x0196)
 
0018b7f0: 2c420008 sltiu r2,r2,0x0008        |r2 = 0x01 if r2 < 8 / Else 0x00 : r2 =0x01 if used attack is a charge+x ability /// set true if ability ID - 196 is less than 8
 
0018b7f4: 14400003 bne r2,r0,0x0018b804      #If r2 = 0x00 (not a charge+x ability)
 
0018b7f8: 00031040 sll r2,r3,0x01            |r2 = r3*2 (charge + x ID*2)
 
0018b7fc: 34030196 ori r3,r0,0x0196              |r3 = 0x0196 (Charge + 1 ID)
 
0018b800: 00031040 sll r2,r3,0x01                |r2 = charge+1 ID *2
 
0018b804: 3c018006 lui r1,0x8006              |
 
0018b808: 00220821 addu r1,r1,r2              |r1 = 8006XXXX (XXXX = Ability ID * 2)
 
0018b80c: 90220d19 lbu r2,0x0d19(r1)          |r2 = Charge Power boost (tricky, using ability ID... maths checked in patcher)
 
0018b810: 3c018019 lui r1,0x8019              |
 
0018b814: a02238e4 sb r2,0x38e4(r1)          |Store Charge Power boost in current ability charge power
 
                                              !! Charge section don't avoid the attack section
 
Attack Section
 
0018b818: 3c028019 lui r2,0x8019
 
0018b81c: 904238ff lbu r2,0x38ff(r2)          |r2 = current ability Weapon Characteristics
 
0018b820: 92300002 lbu r16,0x0002(r17)        |r16 = used weapon formula  (r17 = start of used weapon data 2  - see 0018b52c)
 
0018b824: 30420004 andi r2,r2,0x0004          |r2 = 0x04 if weapon used is available to 2 hands - Else 0x00
 
  0018b828: 10400025 beq r2,r0,0x0018b8c0      #If 2 hands enabled /Else jump to last section /// Branch if 2h is not active
 
0018b82c: 320200ff andi r2,r16,0x00ff        |r2 = used weapon formula
 
0018b830: 3c038019 lui r3,0x8019                  |
 
0018b834: 8c632d94 lw r3,0x2d94(r3)              |r3 = Attacker's Data pointer
 
0018b838: 00000000 nop                            |
 
0018b83c: 90620091 lbu r2,0x0091(r3)              |r2 = Attacker third set of support
 
0018b840: 00000000 nop                            |
 
0018b844: 30420002 andi r2,r2,0x0002              |r2 = 0x02 if using two hands / else 0x00
 
  0018b848: 1040001c beq r2,r0,0x0018b8bc          #If using two hands / else go to last section /// Branch if not using Two Hands
 
0018b84c: 340200ff ori r2,r0,0x00ff                  |r2 = 0xff
 
0018b850: 9064001d lbu r4,0x001d(r3)                  |r4 = Attacker Right Hand Weapon ID
 
0018b854: 00000000 nop                                |
 
0018b858: 14820009 bne r4,r2,0x0018b880              #If weapon ID = 0xFF (do not exist ? 2Hands flag ?) /// Branch if Right hand weapon exists
 
0018b85c: 00000000 nop                                    |
 
0018b860: 9062001e lbu r2,0x001e(r3)                      |r2 = right hand shield /// Load Left Hand Weapon
 
0018b864: 00000000 nop
 
0018b868: 14440005 bne r2,r4,0x0018b880                  #If right hand shield ID = right weapon ID (is 0xFF)/// if Left hand weapon Exists
 
0018b86c: 34020001 ori r2,r0,0x0001                          |r2 = 0x01                      
 
0018b870: 3c018019 lui r1,0x8019                              |
 
0018b874: a02238d9 sb r2,0x38d9(r1)                          |Store Two Hands as active
 
0018b878: 3c038019 lui r3,0x8019                              |
 
0018b87c: 8c632d94 lw r3,0x2d94(r3)                          |r3 = Attacker's Data pointer
 
0018b880: 00000000 nop                                |
 
0018b884: 9064001f lbu r4,0x001f(r3)                  |r4 = Left Hand Weapon ID
 
0018b888: 340200ff ori r2,r0,0x00ff                  |r2 = 0xFF
 
0018b88c: 1482000c bne r4,r2,0x0018b8c0              #If Left hand weapon ID = 0xFF / Else go to last section  ///Branch if Left Hand Weapon Does exist
 
0018b890: 320200ff andi r2,r16,0x00ff                |r2 = used weapon formula
 
0018b894: 90620020 lbu r2,0x0020(r3)                      |r2 = Left hand shield
 
0018b898: 00000000 nop                                    |
 
0018b89c: 14440008 bne r2,r4,0x0018b8c0                    #If Left hand shield ID = 0xFF / Else go to last section /// Branch if Right Hand Weapon does exist
 
0018b8a0: 320200ff andi r2,r16,0x00ff                      |r2 = move ability formula into r2 weapon formula
 
0018b8a4: 34020001 ori r2,r0,0x0001                            |r2 = 1
 
0018b8a8: 3c018019 lui r1,0x8019                              |
 
0018b8ac: a02238d9 sb r2,0x38d9(r1)                            |Store 0x01 in 801938d9 (2 Hands active) /// Store Two Hands as forced
 
0018b8b0: 08062e30 j 0x0018b8c0                                > Jump to last section if not using any weapons, use formula 0x1
 
0018b8b4: 320200ff andi r2,r16,0x00ff                          |r2 = Weapon formula
 
 
   
 
   
  Blank, Defend, Equip change Section
+
                                            {{f/com|--CHARGE--}}
  0018b8b8: 34100001 ori r16,r0,0x0001      r16 = 0x01 formula for equip change is 0x1 lol
+
0018b7e4: 97a30012 lhu r3,0x0012(r29)            |{{f/load|<nowiki>r3 = Attacker last used ability ID</nowiki>}}
  0018b8bc: 320200ff andi r2,r16,0x00ff    #J# r2 = r16 (suposed to be weapon Load Ability formula into r2. every skillset refers here after deciding formula, except for attack and charge if using two hands
+
0018b7e8: 00000000 nop                          |
 +
  0018b7ec: 2462fe6a addiu r2,r3,-0x0196          |{{f/std|<nowiki>r2 = ability ID - 196  (Note : Charge+1 ID = 0x0196)</nowiki>}}
 +
  0018b7f0: 2c420008 sltiu r2,r2,0x0008            |{{f/std|<nowiki>r2 =0x01 if used attack is a charge+x ability</nowiki>}}
 +
0018b7f4: 14400003 bne r2,r0,0x0018b804          {{f/Cond|<nowiki>If Used ability is not a charge ability</nowiki>}}
 +
0018b7f8: 00031040 sll r2,r3,0x01                |{{f/std|<nowiki>r2 = r3*2 (charge + x ID*2)</nowiki>}}
 +
0018b7fc: 34030196 ori r3,r0,0x0196                  |{{f/std|<nowiki>r3 = 0x0196 (Charge + 1 ID)</nowiki>}}
 +
0018b800: 00031040 sll r2,r3,0x01                   |{{f/std|<nowiki>r2 = charge+1 ID *2</nowiki>}}
 +
0018b804: 3c018006 lui r1,0x8006                    |
 +
  0018b808: 00220821 addu r1,r1,r2                 |{{f/std|<nowiki>r1 = 8006XXXX (XXXX = Ability ID * 2)</nowiki>}}
 +
0018b80c: 90220d19 lbu r2,0x0d19(r1)            |{{f/load|<nowiki>r2 = Charge Power boost (using ability ID... maths checked in patcher)</nowiki>}}
 +
0018b810: 3c018019 lui r1,0x8019                |
 +
0018b814: a02238e4 sb r2,0x38e4(r1)              |{{f/store|<nowiki>Store Charge Power boost in current ability charge power(0x801938e4)</nowiki>}}
 
   
 
   
(Jump from default avoiding draw out check)
+
                                            {{f/com|--ATTACK / CHARGE--}}
  0018b8c0: 3c018019 lui r1,0x8019   #J# two-hands attack/charge links here
+
  0018b818: 3c028019 lui r2,0x8019                 |
  0018b8c4: a42038c8 sh r0,0x38c8(r1)       Store 0x00 in current ability 0x38c8 Spell Proc Ability ID / reaction stuff ?
+
  0018b81c: 904238ff lbu r2,0x38ff(r2)             |{{f/load|<nowiki>r2 = current ability Weapon Characteristics</nowiki>}}
  0018b8c8: 3c018019 lui r1,0x8019
+
  0018b820: 92300002 lbu r16,0x0002(r17)           |{{f/load|<nowiki>r16 = used weapon formula</nowiki>}} {{f/load|<nowiki>  (r17 = start of used weapon data 2  - see 0018b52c)</nowiki>}}
0018b8cc: a02038ed sb r0,0x38ed(r1)      Store 0x00 in current ability 0x38ed (fall related ? poach ?) /// Zero post-attack effects (not poach or fall damage?)
+
  0018b824: 30420004 andi r2,r2,0x0004            |{{f/std|<nowiki>r2 = 0x04 if weapon used is available to 2 hands - Else 0x00</nowiki>}}
  0018b8d0: 10400003 beq r2,r0,0x0018b8e0  #If r2 <> 0x00  (supposed to host formula ID /// branch if attack formula is 0
+
  0018b828: 10400025 beq r2,r0,0x0018b8c0          {{f/Cond|<nowiki>If used weapon is 2 hands compatible</nowiki>}} {{f/Cond|<nowiki> /Else jump after action menu section</nowiki>}}
  0018b8d4: 2c420065 sltiu r2,r2,0x0065        |r2 = 0x01 if formula ID <= 0x64 / Else 0x00 /// set r2 to true if formula is less than 0x64
+
  0018b82c: 320200ff andi r2,r16,0x00ff            |{{f/std|<nowiki>r2 = used weapon formula</nowiki>}}
  0018b8d8: 14400002 bne r2,r0,0x0018b8e4      #If formula ID > 0x64 /// branch if formula is between 0x1 and 0x64 (exclusive)
+
0018b830: 3c038019 lui r3,0x8019                    |{{f/std|<nowiki> </nowiki>}}
0018b8dc: 00000000 nop                            |
+
  0018b834: 8c632d94 lw r3,0x2d94(r3)                  |{{f/adr|<nowiki>r3 = Attacker's Data pointer</nowiki>}}
  0018b8e0: 34100001 ori r16,r0,0x0001      E#      |r16 = 0x01
+
  0018b838: 00000000 nop                              |
  0018b8e4: 3c058019 lui r5,0x8019              E#
+
  0018b83c: 90620091 lbu r2,0x0091(r3)                 |{{f/load|<nowiki>r2 = Attacker third set of support</nowiki>}}
  0018b8e8: 24a538da addiu r5,r5,0x38da    r5 = 0x801938da (Current Ability proc ID) /// Load Weapon Proc Location
+
  0018b840: 00000000 nop                              |
  0018b8ec: 90a70000 lbu r7,0x0000(r5)      r7 = Ability proc ID
+
  0018b844: 30420002 andi r2,r2,0x0002                |{{f/std|<nowiki>r2 = 0x02 if using two hands / else 0x00</nowiki>}}
  0018b8f0: 321100ff andi r17,r16,0x00ff    r17 = Ability formula
+
  0018b848: 1040001c beq r2,r0,0x0018b8bc              {{f/Cond|<nowiki>If attacker is using two hands</nowiki>}} {{f/Cond|<nowiki> / else jump after action menu section</nowiki>}}
  0018b8f4: 34020003 ori r2,r0,0x0003      r2 = 0x03
+
  0018b84c: 340200ff ori r2,r0,0x00ff                      |{{f/std|<nowiki>r2 = 0xff</nowiki>}}
  0018b8f8: 16220002 bne r17,r2,0x0018b904  #If Formula = 0x03 ///Branch if formula isn't 0x3
+
  0018b850: 9064001d lbu r4,0x001d(r3)                     |{{f/load|<nowiki>r4 = Attacker Right Hand Weapon ID</nowiki>}}
  0018b8fc: 24a5002c addiu r5,r5,0x002c    r5 = 0x80193906 (inflicting status type location)
+
0018b854: 00000000 nop                                  |
  0018b900: 00003821 addu r7,r0,r0              |r7 = 0x00 (Force status ID to 0x00 for next Jal)
+
  0018b858: 14820009 bne r4,r2,0x0018b880                  {{f/Cond|<nowiki>If weapon ID = 0xFF (do not exist ? 2Hands flag ?)</nowiki>}}
  0018b904: 30e200ff andi r2,r7,0x00ff      r2 = Ability proc ID
+
  0018b85c: 00000000 nop                                      |{{f/std|<nowiki> </nowiki>}}
  0018b908: 00022040 sll r4,r2,0x01        r4 = r2 * 2
+
  0018b860: 9062001e lbu r2,0x001e(r3)                        |{{f/load|<nowiki>r2 = right hand shield</nowiki>}}
  0018b90c: 00822021 addu r4,r4,r2          r4 = r4 + r2 (r2 * 3)
+
0018b864: 00000000 nop                                      |
  0018b910: 00042040 sll r4,r4,0x01         r4 = r4 * 2 (r2*6)
+
  0018b868: 14440005 bne r2,r4,0x0018b880                      {{f/Cond|<nowiki>If right hand shield ID = right weapon ID (is 0xFF)</nowiki>}} {{f/Cond|<nowiki>Shield do not exist</nowiki>}}
  0018b914: 3c028006 lui r2,0x8006         
+
  0018b86c: 34020001 ori r2,r0,0x0001                              |{{f/std|<nowiki>r2 = 0x01</nowiki>}}
  0018b918: 24423fc4 addiu r2,r2,0x3fc4    r2 = 0x80063fc4 (Start of inflict statuses table)
+
  0018b870: 3c018019 lui r1,0x8019                                |
  0018b91c: 00822021 addu r4,r4,r2          r4 = start of Ability Status Proc ID Table
+
  0018b874: a02238d9 sb r2,0x38d9(r1)                             |{{f/store|<nowiki>Store 0x01 at current ability 0x801938d9 flag (Two Hands is active)</nowiki>}}
  0018b920: 0c017895 jal 0x0005e254        --> [[Store_X_Byte_into_Y]] Store Status ID information at 0x80193906 - 0x8019390b (Current ability satuts section)
+
0018b878: 3c038019 lui r3,0x8019                                |
0018b924: 34060006 ori r6,r0,0x0006      r6 = 0x06 (limit for above)
+
  0018b87c: 8c632d94 lw r3,0x2d94(r3)                     |{{f/adr|<nowiki>r3 = Attacker's Data pointer</nowiki>}}
  0018b928: 0c062e7e jal 0x0018b9f8        --> [[Remove_Status]] if status type is cancel - store statuses at 0x80193860 to 0x80193864
+
  0018b880: 00000000 nop                                  |
  0018b92c: 00000000 nop        
+
  0018b884: 9064001f lbu r4,0x001f(r3)                    |{{f/load|<nowiki>r4 = Left Hand Weapon ID</nowiki>}}
0018b930: 3c018019 lui r1,0x8019
+
  0018b888: 340200ff ori r2,r0,0x00ff                      |{{f/std|<nowiki>r2 = 0xFF</nowiki>}}
  0018b934: a03038e5 sb r16,0x38e5(r1)      Store r16 in current Ability formula
+
  0018b88c: 1482000c bne r4,r2,0x0018b8c0                  {{f/Cond|<nowiki>If Left hand weapon ID = 0xFF (do not exist)</nowiki>}} /Else branch after action menu sections
  0018b938: 0c063279 jal 0x0018c9e4        --> [[%27Reflect%27,_Blade_Grasp,_and_Arrow_Guard]] - Set hit flag to 0x00 if succeed
+
  0018b890: 320200ff andi r2,r16,0x00ff                    |{{f/std|<nowiki>r2 = used weapon formula </nowiki>}}
  0018b93c: 00000000 nop
+
  0018b894: 90620020 lbu r2,0x0020(r3)                         |{{f/load|<nowiki>r2 = Left hand shield</nowiki>}}
0018b940: 3c028019 lui r2,0x8019
+
  0018b898: 00000000 nop                                       |
0018b944: 8c422d90 lw r2,0x2d90(r2)      r2 = Target Current Action Data Pointer
+
  0018b89c: 14440008 bne r2,r4,0x0018b8c0                      {{f/Cond|<nowiki>If Left hand shield ID = 0xFF (Shield do not exist)</nowiki>}} /Else branch after action menu sections
  0018b948: 00000000 nop
+
  0018b8a0: 320200ff andi r2,r16,0x00ff                        |{{f/std|<nowiki>r2 = used weapon formula </nowiki>}}
0018b94c: 90420000 lbu r2,0x0000(r2)     r2 = Target Current Action Hit Flag
+
  0018b8a4: 34020001 ori r2,r0,0x0001                             |{{f/std|<nowiki>r2 = 0x01</nowiki>}}
  0018b950: 00000000 nop            
+
  0018b8a8: 3c018019 lui r1,0x8019                                 |
  0018b954: 14400003 bne r2,r0,0x0018b964  If Attack missed / Branch if attack hit
+
  0018b8ac: a02238d9 sb r2,0x38d9(r1)                             |{{f/store|<nowiki>Store 0x01 at current ability 0x801938d9 flag (Two Hands is active)</nowiki>}}
  0018b958: 00111080 sll r2,r17,0x02        r2 = Ability formula ID * 2 into r2
+
  0018b8b0: 08062e30 j 0x0018b8c0                                  {{f/jump|<nowiki> Jump after action menu sections</nowiki>}}
0018b95c: 08062e77 j 0x0018b9dc              > Jump to end (if Attack Missed)
+
  0018b8b4: 320200ff andi r2,r16,0x00ff                            |{{f/std|<nowiki>r2 = Weapon formula</nowiki>}}
  0018b960: 34020001 ori r2,r0,0x0001           |r2 = 0x01
+
   
  0018b964: 3c018019 lui r1,0x8019
+
                                            {{f/com|-- BLANK / DEFEND / EQUIP CHANGE --}}
  0018b968: 00220821 addu r1,r1,r2          r1 = 0x801900xx (xx = Formula ID)
+
  0018b8b8: 34100001 ori r16,r0,0x0001            |{{f/std|<nowiki>r16 = 0x01 formula for equip change is 0x01</nowiki>}}
  0018b96c: 8c22f610 lw r2,-0x09f0(r1)     Load Formula Table
+
  0018b8bc: 320200ff andi r2,r16,0x00ff            |{{f/std|<nowiki>r2 = r16 (future ability formula)</nowiki>}}
  0018b970: 00000000 nop
+
   
  0018b974: 0040f809 jalr r2,r31            --> Jumps to appropriate formula Formulas
+
  0018b8c0: 3c018019 lui r1,0x8019                |
  0018b978: 00000000 nop
+
  0018b8c4: a42038c8 sh r0,0x38c8(r1)        |{{f/store|<nowiki>Store 0x00 in current ability 0x38c8 (reaction flag ?)</nowiki>}}
  0018b97c: 2e220007 sltiu r2,r17,0x0007    r2 = 0x01 if formula ID <= 0x06
+
  0018b8c8: 3c018019 lui r1,0x8019            |
  0018b980: 10400004 beq r2,r0,0x0018b994   #If Formula <= 0x06
+
  0018b8cc: a02038ed sb r0,0x38ed(r1)         |{{f/store|<nowiki>Store 0x00 in current ability 0x38ed (fall related ? poach ?) /// Zero post-attack effects (not poach or fall damage?)</nowiki>}}
  0018b984: 34020064 ori r2,r0,0x0064      r2 = 0x64
+
  0018b8d0: 10400003 beq r2,r0,0x0018b8e0    {{f/Cond|<nowiki>If future formula ID is not 0x00</nowiki>}} /Else branch to force formula ID to be 0x01
  0018b988: 0c061f28 jal 0x00187ca0            --> [[Formula_01_-_06_Aftermath]] (Contains poach and secret hunt)
+
  0018b8d4: 2c420065 sltiu r2,r2,0x0065            |{{f/std|<nowiki>r2 = 0x01 if formula ID <= 0x64 / Else 0x00</nowiki>}}
  0018b98c: 00000000 nop                        |
+
  0018b8d8: 14400002 bne r2,r0,0x0018b8e4          {{f/Cond|<nowiki>If formula ID > 0x64 </nowiki>}} /Else branch avoiding formula beeing set to 0x01
0018b990: 34020064 ori r2,r0,0x0064          |r2 = 0x64
+
0018b8dc: 00000000 nop                               |{{f/std|<nowiki> </nowiki>}}
  0018b994: 16220003 bne r17,r2,0x0018b9a4 #If Formula ID = 0x64
+
  0018b8e0: 34100001 ori r16,r0,0x0001        {{f/Cond|<nowiki>ELSE (formula is 0x00)</nowiki>}} {{f/std|<nowiki>r16 = 0x01 (if formula = 0x00 or > 0x64)</nowiki>}}
0018b998: 00000000 nop                        |
+
  0018b8e4: 3c058019 lui r5,0x8019            |
0018b99c: 3c018019 lui r1,0x8019              |
+
  0018b8e8: 24a538da addiu r5,r5,0x38da      |{{f/std|<nowiki>r5 = 0x801938da (Current Ability proc ID)</nowiki>}}
0018b9a0: a02038d8 sb r0,0x38d8(r1)           |Store 0x00 in Current ability used weapon ID
+
  0018b8ec: 90a70000 lbu r7,0x0000(r5)        |{{f/load|<nowiki>r7 = Ability/Weapon proc ID </nowiki>}}
0018b9a4: 0c062e91 jal 0x0018ba44        --> [[Set_some_data_for_current_attack]]
+
  0018b8f0: 321100ff andi r17,r16,0x00ff      |{{f/std|<nowiki>r17 = Ability formula</nowiki>}}
  0018b9a8: 00000000 nop
+
  0018b8f4: 34020003 ori r2,r0,0x0003        |{{f/std|<nowiki>r2 = 0x03</nowiki>}}
  0018b9ac: 3c038019 lui r3,0x8019
+
  0018b8f8: 16220002 bne r17,r2,0x0018b904    {{f/Cond|<nowiki>If Formula = 0x03 </nowiki>}}
0018b9b0: 8c632d90 lw r3,0x2d90(r3)      |r3 = Target Current Action Data Pointer
+
  0018b8fc: 24a5002c addiu r5,r5,0x002c      |{{f/std|<nowiki>r5 = 0x80193906 (inflicting status type location)</nowiki>}}
  0018b9b4: 00000000 nop
+
  0018b900: 00003821 addu r7,r0,r0                |{{f/std|<nowiki>r7 = 0x00 (Force status ID to 0x00 for formula 0x03)</nowiki>}}
0018b9b8: 94620010 lhu r2,0x0010(r3)      |r2 = Target Current Action Special Action Flags
+
0018b904: 30e200ff andi r2,r7,0x00ff        |{{f/std|<nowiki>r2 = Current Ability proc ID</nowiki>}}
0018b9bc: 00000000 nop
+
0018b908: 00022040 sll r4,r2,0x01          |{{f/std|<nowiki>r4 = r2 * 2</nowiki>}}
  0018b9c0: 10400006 beq r2,r0,0x0018b9dc  #If There are specials flags
+
0018b90c: 00822021 addu r4,r4,r2            |{{f/std|<nowiki>r4 = r2*3</nowiki>}}
0018b9c4: 00001021 addu r2,r0,r0          r2 = 0x00 (why are we setting r2 to 0 if we're branch if its already 0?)
+
0018b910: 00042040 sll r4,r4,0x01          |{{f/std|<nowiki>r4 = r2*6 (Proc ID *6)</nowiki>}}
  0018b9c8: 90620025 lbu r2,0x0025(r3)          |r2 = Target Current Action attack-type
+
0018b914: 3c028006 lui r2,0x8006            |
  0018b9cc: 00000000 nop                       |
+
0018b918: 24423fc4 addiu r2,r2,0x3fc4      |{{f/std|<nowiki>r2 = 0x80063fc4 (Start of inflict statuses table)</nowiki>}}
  0018b9d0: 34420001 ori r2,r2,0x0001          |Update r2 with 0x01
+
0018b91c: 00822021 addu r4,r4,r2            |{{f/std|<nowiki>r4 = start of Current Ability Status Proc ID Table</nowiki>}}
  0018b9d4: a0620025 sb r2,0x0025(r3)          |Store attack-type as Pseudo-Status change
+
0018b920: 0c017895 jal 0x0005e254          |{{f/jal| Store_X_Byte_into_Y |<nowiki> Store_X_Byte_into_Y </nowiki>}} Store Status data in current ability  at 0x80193906 - 0x8019390b
  0018b9d8: 00001021 addu r2,r0,r0              |r2 = 0x00
+
0018b924: 34060006 ori r6,r0,0x0006        |{{f/std|<nowiki>r6 = 0x06 (limit for above)</nowiki>}}
  0018b9dc: 8fbf0034 lw r31,0x0034(r29)    End
+
0018b928: 0c062e7e jal 0x0018b9f8          |{{f/jal| Remove_Status |<nowiki> Remove_Status </nowiki>}} if status type is cancel - store statuses set from status ID at 0x80193860 to 0x80193864
  0018b9e0: 8fb20030 lw r18,0x0030(r29)
+
0018b92c: 00000000 nop                      | -- Note: Can cause issues if repurposing the Inflict Status byte in a formula. See [[Formulas]] for more info.
  0018b9e4: 8fb1002c lw r17,0x002c(r29)
+
0018b930: 3c018019 lui r1,0x8019            |
0018b9e8: 8fb00028 lw r16,0x0028(r29)
+
0018b934: a03038e5 sb r16,0x38e5(r1)        |{{f/store|<nowiki>Store r16 in current Ability formula</nowiki>}}
0018b9ec: 27bd0038 addiu r29,r29,0x0038
+
0018b938: 0c063279 jal 0x0018c9e4          |{{f/jal| %27Reflect%27,_Blade_Grasp,_and_Arrow_Guard |<nowiki> %27Reflect%27,_Blade_Grasp,_and_Arrow_Guard </nowiki>}}  - Set target current action hit flag to 0x00 if succeed
  0018b9f0: 03e00008 jr r31
+
0018b93c: 00000000 nop                      |
  0018b9f4: 00000000 nop      
+
0018b940: 3c028019 lui r2,0x8019            |
 +
0018b944: 8c422d90 lw r2,0x2d90(r2)        |{{f/adr|<nowiki>r2 = Target Current Action Data Pointer</nowiki>}}
 +
0018b948: 00000000 nop                      |
 +
0018b94c: 90420000 lbu r2,0x0000(r2)        |{{f/load|<nowiki>r2 = Target Current Action Hit Flag</nowiki>}}
 +
0018b950: 00000000 nop                      |
 +
0018b954: 14400003 bne r2,r0,0x0018b964    {{f/Cond|<nowiki>If Attack missed (from reflect / blade grasp / arrow guard)</nowiki>}} /Else avoid the jump to end
 +
0018b958: 00111080 sll r2,r17,0x02          |{{f/std|<nowiki>r2 = Ability formula ID * 4</nowiki>}}
 +
0018b95c: 08062e77 j 0x0018b9dc                  {{f/jump|<nowiki> Jump to END! With r2=0x01</nowiki>}}
 +
0018b960: 34020001 ori r2,r0,0x0001              |{{f/std|<nowiki>r2 = 0x01</nowiki>}}
 +
0018b964: 3c018019 lui r1,0x8019            |{{f/std|<nowiki> </nowiki>}}
 +
0018b968: 00220821 addu r1,r1,r2            |{{f/std|<nowiki>r1 = 0x801900xx (xx = Formula ID*4)</nowiki>}}
 +
0018b96c: 8c22f610 lw r2,-0x09f0(r1)        |{{f/adr|<nowiki>Load Formula routine adress</nowiki>}} / from [[Formula_Table]]
 +
0018b970: 00000000 nop                      |
 +
0018b974: 0040f809 jalr r2,r31              |{{f/jal| Jumps to appropriate formula routine|<nowiki> Jumps to appropriate formula routine</nowiki>}} /[[Formulas]]
 +
0018b978: 00000000 nop                      |
 +
0018b97c: 2e220007 sltiu r2,r17,0x0007      |{{f/std|<nowiki>r2 = 0x01 if formula ID <= 0x06</nowiki>}}
 +
0018b980: 10400004 beq r2,r0,0x0018b994    {{f/Cond|<nowiki>If formula ID <= 0x06</nowiki>}}
 +
0018b984: 34020064 ori r2,r0,0x0064        |{{f/std|<nowiki>r2 = 0x64</nowiki>}}
 +
0018b988: 0c061f28 jal 0x00187ca0                |{{f/jal| Formula_01_-_06_Aftermath|<nowiki> Formula_01_-_06_Aftermath</nowiki>}}  (Contains poach and secret hunt)
 +
0018b98c: 00000000 nop                          |
 +
0018b990: 34020064 ori r2,r0,0x0064              |{{f/std|<nowiki>r2 = 0x64</nowiki>}}
 +
0018b994: 16220003 bne r17,r2,0x0018b9a4    {{f/Cond|<nowiki>If Formula ID = 0x64  (jump)</nowiki>}}
 +
0018b998: 00000000 nop                          |{{f/std|<nowiki>  </nowiki>}}
 +
0018b99c: 3c018019 lui r1,0x8019                |{{f/std|<nowiki>  </nowiki>}}
 +
0018b9a0: a02038d8 sb r0,0x38d8(r1)              |{{f/store|<nowiki>Store 0x00 in Current ability used weapon ID (0x801938d8)</nowiki>}}
 +
0018b9a4: 0c062e91 jal 0x0018ba44          |{{f/jal|Set_some_data_for_current_attack|<nowiki>Set_some_data_for_current_attack</nowiki>}}
 +
0018b9a8: 00000000 nop                      |
 +
0018b9ac: 3c038019 lui r3,0x8019            |
 +
0018b9b0: 8c632d90 lw r3,0x2d90(r3)        |{{f/adr|<nowiki>r3 = Target Current Action Data Pointer</nowiki>}}
 +
0018b9b4: 00000000 nop                      |
 +
0018b9b8: 94620010 lhu r2,0x0010(r3)        |{{f/load|<nowiki>r2 = Target Current Action Special Action Flags</nowiki>}}
 +
0018b9bc: 00000000 nop                      |
 +
0018b9c0: 10400006 beq r2,r0,0x0018b9dc    {{f/Cond|<nowiki>If There are specials flags </nowiki>}}
 +
0018b9c4: 00001021 addu r2,r0,r0            |{{f/std|<nowiki>r2 = 0x00 </nowiki>}}
 +
0018b9c8: 90620025 lbu r2,0x0025(r3)            |{{f/load|<nowiki>r2 = Target Current Action attack-type</nowiki>}}
 +
0018b9cc: 00000000 nop                          |
 +
0018b9d0: 34420001 ori r2,r2,0x0001              |{{f/std|<nowiki>Update r2 with 0x01</nowiki>}}
 +
0018b9d4: a0620025 sb r2,0x0025(r3)              |{{f/store|<nowiki>Store target current action attack-type as Pseudo-Status change</nowiki>}}
 +
0018b9d8: 00001021 addu r2,r0,r0                |{{f/std|<nowiki>r2 = 0x00</nowiki>}}
 +
0018b9dc: 8fbf0034 lw r31,0x0034(r29)      |{{f/adr|<nowiki>End</nowiki>}}
 +
0018b9e0: 8fb20030 lw r18,0x0030(r29)     
 +
0018b9e4: 8fb1002c lw r17,0x002c(r29)     
 +
0018b9e8: 8fb00028 lw r16,0x0028(r29)     
 +
0018b9ec: 27bd0038 addiu r29,r29,0x0038   
 +
  0018b9f0: 03e00008 jr r31                  
 +
  0018b9f4: 00000000 nop
  
 
==Return Locations:==
 
==Return Locations:==
Line 471: Line 456:
 
  0017f284: [[Calculate Projected Action Effect]]
 
  0017f284: [[Calculate Projected Action Effect]]
 
  0018ada8: [[Double WP if two hands is equipped?]]
 
  0018ada8: [[Double WP if two hands is equipped?]]
 
+
===Summary===
==Short Summary==  
+
  Pre Formula routine will set a bunch of current ability data mainly based on skillset <span id="PFSShort"></span>
  Need r4 = Attacker data pointer / r5 = defender ID <span id="PFSShort"></span>
+
  and reset most of the Attacker and target current action before jumping into formula section.
  -------------------------------------
+
 
  Set various section of current ability / current action data
+
  '''In all cases '''
-
+
    0x80192d98 - Store Target data pointer (from 0x801908cc based on target ID)
  Store defender ID in Current Ability data at 0x801938c1
+
    0x80192d90 - Store Target current action data pointer (Target data +0x01c0)
Store defender data start location in 0x80192d98
+
    0x80192d8c - Store 0x80192da0 (copy of Attacker action data)
Store defender current action data pointer at 0x80192d90
+
    0x80192d94 - Store Attacker data pointer (from 0x801908cc based on unit ID)
-
+
 
Store attacker ID in Current Ability data (at 0x801938c0)
+
    Current Ability Data
Store Attacker current action data pointer at 0x80192d8c
+
    0x801938c1 - Store Target ID
Store attacker data start location in 0x80192d94
+
    0x801938c0 - Store Attacker ID
-
+
    0x8019390e - Store 0x00 in post formula flags (deal with poach and train)
Exit here if Fall Damage or some reactions checked in [[Perform_reaction_abilities]]
+
 
(at this point, formula is nullified)
+
  '''Then two shortcut's to end'''
-
+
    Reaction Fork - if reacting (0x8019f5f0 = 0x01) with a non-counter non-guard ability (cf [[Perform_reaction_abilities]])
Store defender terrain type at 0x801938cd
+
        Play the reactions ability
Store Used weapon ID at 0x801938d8
+
        Store data at 0x801938d8 via [[Store_used_weapon]]
Store used Ability ID at 0x801938d6
+
        Exit routine
-
+
Copy used Ability Data 2 into current ability section (0x801938F0 to 0x801938FD)
+
    Fall Damage fork - Check value at 0x801938ed if 0x80 is enabled deal with fall damage and exit (cf [[Knockback%3F]])
Copy used Weapon Data 2 into current ability section (0x801938FE to 0x80193805)
+
 
-
+
 
Store Status/Proc ID at 0x801938da
+
  '''Main stream'''
store attacker faith at 0x801938d3
+
    Store a bunch of data in current ability section - depending on action menu, skillset and ability ID
store defender faith at 0x801938d2
+
   
-
+
    0x801938c6 - Reaction ID : set to 0x00 if 0x801938c8 = 0x00
Nullify attacker and defender most of current action data [[Action_data_nulling]]
+
    0x801938c8 - Set to 0x00 after the big action menu section (before that it's used several times in the routine)
-
+
    0x801938cd - Store Target terrain type
Store used skillset at 0x801938d4
+
    0x801938d2 - Store target's faith
Nullify 0x801938c6 (reaction ability ID)
+
    0x801938d3 - Store attacker's faith
-
+
    0x801938d4 - Store used ability skillset (from attacker data 0x16f)
Store data in Current action 0x18 (evade with motion - missed Vs guarded)
+
    0x801938d6 - Store used ability ID :
-
+
                  - By default from attacker data 0x170
  Update/disable some of the previous according to action menu / frog check
+
                  - If 0x801938c8 <> 0x00 : take the value of 0x801938c6 (reaction ID)
-
+
                  - If Action menu is katana inventory : store used item ID (attacker data 0x176) + 0x26
Enable or disable two hands at 0x801938d9
+
                                                          (Katana ID + 0x26 = Ability ID corresponding to katana)
Enable or not charge power at 0x801938e4
+
                  - If Action menu is element : Ability ID is hardcoded from Attacker terrain type (cf [[Get_Elemental_Ability_ID]])
Nullify 0x801938c8
+
Nullify 0x801938ed
+
    0x801938d8 - Store used weapon ID
-
+
                  - Right hand weapon if 0x801938c3 = 0x00
Store inflicted status from 0x80193906 to 0x8019390b
+
                  - Left hand weapon if 0x801938c3 <> 0x00
Note : formula 0x03 is forced to inflicted stauts ID 0x00
+
                  - Used Item ID if Attacker last used skillset is drawout (Attacker data 0x016f = 0x13)
If inflicted status is cancel : store statuses sets from 0x80193860 to 0x80193864
+
                  - Set to 0x00 if ID of the three cases above is >= 80 (not a weapon)
-
+
                  - Set to 0x00 if default action menu, target is frog and 801938c8 = 0x00 (...)
Store formula at 0x801938e5
+
                  - Set to 0x00 if action menu = geomancy/default/monster/math and neither weapon strike nor wepon range are checked ( 0x801938f3 )
Jump to formula routine
+
                  - Used item ID (from attacker data 0x176) if action menu is item inventory
--not revised from here--
+
                  - Set to 0x00 after jump to formula if formula was 0x64 (jump abilities)
[[Formula_01_-_06_Aftermath]]
+
   
If formula = 0x64 : nullify used weapon ID
+
    0x801938d9 - By default, set to 0x00
[[Set_some_data_for_current_attack]]
+
                  - Set to 0x01 if : - action menu is attack or charge
Update current action type with pseudo status enabled
+
                                        and ability used weapon is compatible with two hands (0x801938ff has 0x04 enabled)
-
+
                                        and attacker use two-hands (Attacker data 0x91 has 0x02 enabled)
 
+
                                        and one of the Attacker hands has Weapon AND shield ID = 0xFF (Attacker datas 0x1d, 0x1e,0x1f,0x20)
==Long summary==
+
   
Need r4 = Attacker data pointer / r5 = defender ID <span id="PFSLong"></span>
+
    0x801938da - Store ability proc ID :
---------------
+
                  - Weapon Proc ID by default (from used weapon data table) (before action menu section)
  [[Copy_Byte_Data_(20_Bytes)]] Copy attacker data on tempory stack
+
                  - Ability proc ID if action menu is geomancy/katana/default/monster/math
-
+
   
  Store defender ID in Current Ability data at 0x801938c1
+
    0x801938db - Store used item ID if action menu is item inventory. Values from 0x00 (potion) to 0x0D (phoenix down)
Store defender data start location in 0x80192d98
+
    0x801938e4 - Store charge power :
Store defender current action data pointer at 0x80192d90
+
                  - By default to 0x00 (before action menu section)
  -
+
                  - If action menu is charge :
Formula set to 0x00 at 0x8019390e
+
                        - if ability ID is between 0x196 and 0x19D : store ability charge power
Store attacker ID in Current Ability data (at 0x801938c0)
+
                        - if not a charge ability, charge power is 0x196 charge power
Store 0x80192da0 at 0x80192d8c = Attacker current action data pointer
+
   
Store attacker data start location in 0x80192d94
+
    0x801938e5 - Store ability formula :
-
+
                  - By default set to 0x01 (defore action menu)
Check 0x8018f5f0 (type of action)
+
                  - If action menu is geomancy/katana/default/monster/math :
- if = 0x01 (= reacting ?) --> Jal [[Perform_reaction_abilities]] ([[Action_data_nulling]] if r2 <>0x00 to be looked further)
+
                      - if Ability ID > potion : set to 0x01
                            - If r2 <> 0 : [[Store_used_weapon]](0x801938d8) and exit directly (formula ste to 0x00)
+
                      - if ability ID <= potion : set to ability formula (from ability ID via SCUS table)
                            - If r2 = 0x00 : Continue (clearly reflect with 0x01 flaged - maybe others)                           
+
                  - If action menu is item inventory : set to item formula (from item ID via Item SCUS table)
Check 0x801938ed (post action byte ?)
+
                  - If action menu is weapon inventory (throw) force formula to 0x63
- if = 0x80 --> [[Knockback%3F]]  
+
                  - If action menu is jump : force formula to 0x64
                            - Call [[Action_data_nulling]]
+
                  - If action menu is charge/attack : set to weapon formula (from SCUS via used weapon ID)
                            - Update 0x801938ed removing 0x80
+
                  - If action menu is blank/defend/equip change set to 0x01
                            - Store Target current action > Attack type = pseudo status (0x01) +/- Hp damage (0x80)
+
                  - If formula is > 0x64 : forced to 0x01
                                                          > HP damage
+
            - Exit routine directly (formula set to 0x00)  
+
     0x801938ed - Set to 0x00 if fall dmg [[Knockback%3F]])
Jal [[Map_Location_Calculation]]
+
              - Set to 0x00 after action menu section
Store defender terrain type at 0x801938cd
+
     Ability data  
-
+
    0x801938f0 to 0x801938fd - Store ability data
Check 0x801938c3 (strike counter ?) xxxxxx
+
              - by default From Ability ID via SCUS ability table
    If = 0x00 : Right hand weapon stored as used weapon 0x801938d8
+
              - If Ability ID > potion : store ability 0x00 data
    If != 0x00 : Left hand weapon stored as used weapon 0x801938d8
+
              - If action menu is item inventory, nullify the bytes
Check Attacker last skillset used
+
    If draw out :Used item (katana) stored as used weapon 0x801938d8
+
    Weapon data
Check loaded Weapon/Item ID (right or left equipped)
+
     0x801938fe to 0x80193905
    If < 0x80 (beginning of shields - End of weapon/throwable) --> store 0x00 as used Weapon ID at 0x801938d8
+
              - by default from weapon ID via SCUS item table
Store Used weapon ID at 0x801938d8
+
              - If used weapon have an ID >= 80 store item 0x00 data
Store used Ability ID at 0x801938d6
+
              - if action menu is geomancy/katana/default/monster/math, and attacker has frog and 0x801938c8 = 0x00 store item 0x00 data
Nullify Two Hands @@@
+
Check Used Ability
+
     Status data
    If >= Hi-potion (potion included ?) --> Ability ID = 0x00
+
    0x80193906 to 0x8019390b - store status data :
Copy used Ability Data 2 into current ability section (0x801938F0 to 0x801938FD)
+
              - from 0x801938da ID (weapon or ability proc - see above) via SCUS table
Copy used Weapon data 2 into current ability section (0x801938FE to 0x80193805)
+
              - if formula = 0x03 store Status 0x00 SCUS data (?)
-
+
   
Nullify charge power
+
    0x80193860 to 0x80193864 - Store status to cancel (is 0x80193906 has cancel enabled) [[Remove_Status]]
Set Formula to 0x01
+
   
Store Status/Proc ID at 0x801938da
+
    Current action data
store attacker faith at 0x801938d3
+
    - reset most of attacker and target current action data via [[Action_data_nulling]]
store defender faith at 0x801938d2
+
        - preserve unit reaction ID and last attack recieved
-
+
        - set current target action hit flag to 'hit' and attacker's one to 'miss'
[[Action_data_nulling]]
+
        - set both hit% to 100%
Nullify attacker and defender most of current action data
+
-keep reaction ID at 0x0e - last attack received at 0x26 - 0x27 ? - from 2a to end
+
    Test blade grasp - reflect and arrow guard [[%27Reflect%27,_Blade_Grasp,_and_Arrow_Guard]]
  -set hit% at 100%
+
        - If reaction occurs, set target hitflag to 'miss', avoid jal to formula section set r2 = 0x01
-set Target action hit flag to 0x01 and attacker's to 0x00
+
   
-Set status infliction and removal bytes to 0x00
+
  Jump to formula  
-set 0x80193860 to 0x80193864 to 0x00
+
   
-
+
  Post formula not investigated
Store used skillset at 0x801938d4
 
-
 
Check 0x801938c8 (Reaction ? Proc ?)
 
  -If <>0x00 - load reaction ID (0x801938c6) and store it at 0x801938d6 (Used ability ID)-
 
  Nullify 0x801938c6 (reaction ability ID)
 
Store 0x01 or 0x02 in TCAD 0x18 after checking first AI byte (target ennemies or allies --> "guarded" or "missed"
 
Update TCADP 0x18 with evade with motion if checked
 
-
 
Check action menu (loaded from used skillset)
 
    If = katana inventory : ability ID is updated from used item ID (katana) + 0x26 (offset between katanas ID and ability) - but why ?
 
  -
 
Check action menu
 
    If < defend (not defend / equip change) load return adress for specifics sections of the routine
 
    Else jump in the defend/equip change  section : set formula to 0x01
 
    > Geomancy section
 
        [[Get_Elemental_Ability_ID]] Hardcoding Ability ID from target terrain type
 
        continues in next section
 
    > Default, Math, Monster, Katana section
 
        Check Ability ID
 
            - If < Hi Potion :
 
                Check If Attacker is a frog
 
                - If Frog : check 0x801938c8 (reaction ? proc ?)
 
                          - If = 0x00 : store 0x00 in used weapon id (0x801938d8)
 
                          copy null weapon data 2 into current ability section (0x801938FE to 0x80193805)
 
                Copy used Ability Data 2 into current ability section (0x801938F0 to 0x801938FD)
 
                Check for weapon strike and ranged weapon
 
                    - if none : check action menu for drawout
 
                              - If not draw out : nullify used weapon ID at 0x801938d8
 
            Avoid others action menus sections
 
    > Item section
 
        Check used item ID (on temporary stack)
 
            - If it's >= Potion ID : Store Item ID in used weapon ID at 0x801938d8
 
                                      Store used item ID (0x00 to 0x27) at 0x801938db
 
                                      Store Item inflicted status in statu/proc ID at 0x801938da
 
        Avoid others action menu sections
 
     > Throw section
 
        Set formula to 0x63
 
        Avoid others action menu section
 
     > Jump section
 
        Set formula to 0x64
 
        Avoid others action menu section
 
     > Charge section
 
        Check used ability ID  
 
            - If not a charge ability : charge power = charge +1
 
            - Store charge power at 0x801938e4
 
    > Attack section
 
        Check Two hands availability and usability
 
            if ok store 0x01 at 0x801938d9
 
     > Blank, Defend, Equip change section
 
        Set formula to 0x01
 
(Back to global routine)
 
Nullify 0x801938c8
 
Nullify 0x801938ed
 
Check ability ID : if = 0x03 --> Force Status ID to 0x00
 
  [[Store_X_Byte_into_Y]] - Store Inflicted Status data in current ability section (0x80193906 to 0x8019390B)
 
  [[Remove_Status]] - if status type is cancel - store statuses at 0x80193860 to 0x80193864
 
-
 
Store Formula at 0x801938e5
 
[[%27Reflect%27,_Blade_Grasp,_and_Arrow_Guard]] - Set hit flag to 0x00 if succeed
 
  If attack missed : jump to end
 
  Jump to formulas routines (via formula table)
 
  -- Not clearly investigated from here--
 
  Check formula
 
    If <= 0x06 [[Formula_01_-_06_Aftermath]]
 
    If = 0x64 : nullify used weapon ID at 0x8019 38d8
 
[[Set_some_data_for_current_attack]]
 
Check specials flags (current action data 0x10)
 
- If any : update action type (current action 0x25)with 0x01 (pseudo status)
 

Latest revision as of 14:15, 8 November 2024

Instructions and notes

Pre Formula Setup (FDC)  Summary 
-------------------------------------
r4 = Attacker current action data pointer / r5 Defender ID
Returns r2 = 0x01 if ability missed before formula jump (reflect, blade graps arrow guard)
        r2 = 0x00 if it jump to formula routines
-------------------------------------
0018b34c: 27bdffc8  addiu r29,r29,0xffc8    |
0018b350: afb00028 sw r16,0x0028(r29)       |
0018b354: 00a08021 addu r16,r5,r0           |r16 = Target ID  
0018b358: 27a50010 addiu r5,r29,0x0010      |
0018b35c: afbf0034 sw r31,0x0034(r29)       |
0018b360: afb20030 sw r18,0x0030(r29)       |
0018b364: 0c01788b jal 0x0005e22c           |--> Copy_Byte_Data_(20_Bytes)  (from r4 to r5 : copy attacker action data on stack)
0018b368: afb1002c sw r17,0x002c(r29)       |
0018b36c: 3c018019 lui r1,0x8019            |
0018b370: a03038c1 sb r16,0x38c1(r1)        |Store ID of the defending unit (Current ability data 0x801938c1 )
0018b374: 321000ff andi r16,r16,0x00ff      |r16 = Last byte of Target ID
0018b378: 001010c0 sll r2,r16,0x03          |r2 = Defender ID * 0x8
0018b37c: 00501023 subu r2,r2,r16           |r2 = defender ID * 0x7
0018b380: 00021180 sll r2,r2,0x06           |r2 = defender ID * 0x1c0
0018b384: 3c048019 lui r4,0x8019            |
0018b388: 248408cc addiu r4,r4,0x08cc       |r4 = Start of Unit Data
0018b38c: 00441821 addu r3,r2,r4            |r3 = Defender data location(start of unit data + Defender battle ID * 0x1c0)
0018b390: 3c018019 lui r1,0x8019            |
0018b394: ac232d98 sw r3,0x2d98(r1)         |Store Defender's Data Location (Current action data 0x80192d98)
0018b398: 2483018c addiu r3,r4,0x018c       |r3 = Start of unit data + 0x018c (current action data)
0018b39c: 00431021 addu r2,r2,r3            |r2 = Current action data + 0x01c0 (Defender current action data)
0018b3a0: 93a30010 lbu r3,0x0010(r29)       |r3 = Load attackers unit ID from stack (from routine 0x0005e22c)
0018b3a4: 3c018019 lui r1,0x8019            |
0018b3a8: ac222d90 sw r2,0x2d90(r1)         |Store Defender's Current Action Data (Current action data 0x80192d90 )
0018b3ac: 3c028019 lui r2,0x8019            |
0018b3b0: 244238c0 addiu r2,r2,0x38c0       |r2 = Load Attacker's Unit ID location
0018b3b4: 3c018019 lui r1,0x8019            |
0018b3b8: a020390e sb r0,0x390e(r1)         |set post formula flag to  0x00  at 0x8019390e
0018b3bc: a0430000 sb r3,0x0000(r2)         |Store ID of the attacking unit (Current Ability data 0x801938c0 )
0018b3c0: 90430000 lbu r3,0x0000(r2)        |r3 = Load ID of the attacking unit
0018b3c4: 3c028019 lui r2,0x8019            |
0018b3c8: 24422da0 addiu r2,r2,0x2da0       |r2 = 0x80192da0 (copy of attacker action data?)
0018b3cc: 3c018019 lui r1,0x8019            |
0018b3d0: ac222d8c sw r2,0x2d8c(r1)         |Store "0x80192da0" into attacker current action data location (current action data 0x80192d8c)
0018b3d4: 000310c0 sll r2,r3,0x03           |r2 = Attacking unit ID * 8
0018b3d8: 00431023 subu r2,r2,r3            |r2 = Attacking unit ID * 7
0018b3dc: 00021180 sll r2,r2,0x06           |r2 = Attacking unit ID * 448 (0x1c0)
0018b3e0: 3c038019 lui r3,0x8019            |
0018b3e4: 8c63f5f0 lw r3,-0x0a10(r3)        |r3 = Loads type of action (word / reacting - pre attack - attack) from 0x8018f5f0 8018F5F0
0018b3e8: 00441021 addu r2,r2,r4            |r2 = Attacker data location (r4 = start of units data + r2 Attacker ID * 448)
0018b3ec: 3c018019 lui r1,0x8019            |
0018b3f0: ac222d94 sw r2,0x2d94(r1)         |Store Attacker's Data location (Current action data 0x80192d94)
0018b3f4: 10600009 beq r3,r0,0x0018b41c     # If reacting /Branch if attack is initial or preview
0018b3f8: 00000000 nop                           | 
0018b3fc: 0c062bcb jal 0x0018af2c                |--> Perform_reaction_abilities   r2 = 0x01 for non counter post action abilities ? /  -0x01 for guard skills/ 0x00 for counter abilities, hamedo and auto-potion (?)
0018b400: 00000000 nop                           |Notes : if r2 = 0x01 Current action data are edited
0018b404: 10400005 beq r2,r0,0x0018b41c          #If Reaction ability is not a counter one
0018b408: 00000000 nop                               | 
0018b40c: 0c062c9d jal 0x0018b274                    |--> Store_used_weapon  (modified by action menu ID)
0018b410: 27a40010 addiu r4,r29,0x0010               |makes r4 a stack pointer for above jal
0018b414: 08062e77 j 0x0018b9dc                      >> Jump to End
0018b418: 00001021 addu r2,r0,r0                     |r2 = 0x00
0018b41c: 3c028019 lui r2,0x8019            #E  #E  Not reacting or reaction is a counter ability
0018b420: 904238ed lbu r2,0x38ed(r2)        |r2 = Can poach/post action byte // Fall damage ?
0018b424: 00000000 nop                      |
0018b428: 30420080 andi r2,r2,0x0080        |r2 = 0x0080 if attack is fall damage / Else = 0x000 (0x80 is flagged as fall dmg not calculated ?)
0018b42c: 10400005 beq r2,r0,0x0018b444     #If attack is fall Dmg  /Else branch
0018b430: 00000000 nop                           | 
0018b434: 0c062b8f jal 0x0018ae3c                |--> Knockback%3F Set Fall Damage
0018b438: 00000000 nop                           |
0018b43c: 08062e77 j 0x0018b9dc                  >> Jump to End
0018b440: 00001021 addu r2,r0,r0                 |r2 = 0x00
0018b444: 3c048019 lui r4,0x8019            #Else  - Attack is not fall dmg
0018b448: 8c842d98 lw r4,0x2d98(r4)         |r4 = Target Data Pointer
0018b44c: 0c060428 jal 0x001810a0           |--> Map_Location_Calculation  Return r2 as Target tile ID
0018b450: 00000000 nop                      |
0018b454: 000210c0 sll r2,r2,0x03           |r2 = Target tile ID x 8
0018b458: 3c018019 lui r1,0x8019            |
0018b45c: 00220821 addu r1,r1,r2            |r1 = 8019 + Tile ID x 8
0018b460: 9022f8cc lbu r2,-0x0734(r1)       |r2 = Target Tile Type  (from 0x8018f8cc + tile ID offset)
0018b464: 3c038019 lui r3,0x8019            |
0018b468: 906338c3 lbu r3,0x38c3(r3)        |r3 = Strike counter  (previous info Weapon Hand (0 = R, 1 = L) ?)
0018b46c: 3042003f andi r2,r2,0x003f        |r2 = Filter out Target tile terrain type
0018b470: 3c018019 lui r1,0x8019            |
0018b474: a02238cd sb r2,0x38cd(r1)         |Store defender terrain type at current ability 0x801938cd  (flagged as caster tile ID in data table ?)
0018b478: 14600005 bne r3,r0,0x0018b490     #If 1rst strike  /Else branch
0018b47c: 00000000 nop                           | 
0018b480: 3c078019 lui r7,0x8019                 | 
0018b484: 90e738c4 lbu r7,0x38c4(r7)             |r7 = Current ability Primary weapon ID
0018b488: 08062d26 j 0x0018b498                  >> Jump after not first strike section
0018b48c: 00000000 nop                           |
0018b490: 3c078019 lui r7,0x8019            #Else -  Not first strike
0018b494: 90e738c5 lbu r7,0x38c5(r7)             |r7 = Current ability secondary weapon ID
0018b498: 93a30011 lbu r3,0x0011(r29)       |r3 =  Attacker Last skillset used 
0018b49c: 34020013 ori r2,r0,0x0013         |r2 = 0x13  (= Draw out ID)
0018b4a0: 14620004 bne r3,r2,0x0018b4b4     # If Draw Out
0018b4a4: 30e200ff andi r2,r7,0x00ff        |r2 = r7 (primary or secondary weapon ID)
0018b4a8: 93a70018 lbu r7,0x0018(r29)            |r7 = Attacker Used item/Equip ID (from Attacker 0x176)
0018b4ac: 00000000 nop                           |
0018b4b0: 30e200ff andi r2,r7,0x00ff             |r2 = Used item
0018b4b4: 2c420080 sltiu r2,r2,0x0080       |r2 = 0x01 if the item is a weapon (ID < 0x80) - Else 0x00 (not a weapon)
0018b4b8: 14400002 bne r2,r0,0x0018b4c4     #If Equiped/used item is not a weapon
0018b4bc: 00000000 nop                           | 
0018b4c0: 00003821 addu r7,r0,r0                 |r7 = 0x00
0018b4c4: 97a30012 lhu r3,0x0012(r29)       |r3 = Attacker Last attack/ability used (attacker 0x170)
0018b4c8: 3c108019 lui r16,0x8019           |
0018b4cc: 261038d8 addiu r16,r16,0x38d8     |r16 = 0x801938d8 - current ability weapon ID adress
0018b4d0: a2070000 sb r7,0x0000(r16)        |Store Attacker used/equiped Weapon ID (0x00 if not a weapon)   at current ability  0x801938d8
0018b4d4: 3c018019 lui r1,0x8019            |
0018b4d8: a42338d6 sh r3,0x38d6(r1)         |Store Attacker used Ability/Attack ID  at current ability  0x801938d6
0018b4dc: 3c028019 lui r2,0x8019            |
0018b4e0: 944238d6 lhu r2,0x38d6(r2)        |Load current ability Used Ability ID
0018b4e4: 3c018019 lui r1,0x8019            |
0018b4e8: a02038d9 sb r0,0x38d9(r1)         |Store Two Hands as inactive (?)
0018b4ec: 2c420171 sltiu r2,r2,0x0171       |r2 = 0x01 if used ability is before Hi-potion
0018b4f0: 14400002 bne r2,r0,0x0018b4fc     # If Ability ID >= Hi-Potion 
0018b4f4: 26050018 addiu r5,r16,0x0018      |r5 = 0x801938F0 - Current Ability Range data location
0018b4f8: 00001821 addu r3,r0,r0                 |r3 = 0x00 (used ability ID = 0x00)
0018b4fc: 000320c0 sll r4,r3,0x03           |r4 = Used Ability ID * 8 
0018b500: 00832023 subu r4,r4,r3            |r4 = Used Ability ID * 7
0018b504: 00042040 sll r4,r4,0x01           |r4 = Used Ability ID * 14 (if ability ID >= Hi potion, r4 = 0x00)
0018b508: 3c028006 lui r2,0x8006            |
0018b50c: 2442fbf0 addiu r2,r2,-0x410       |r2 = Start of Abilities data 2
0018b510: 00822021 addu r4,r4,r2            |r4 = Start of Used Ability (by ID) Data 2
0018b514: 3406000e ori r6,r0,0x000e         |r6 = 0x0e (for next jal)
0018b518: 30e200ff andi r2,r7,0x00ff        |r2 = Equiped/Used Weapon ID (0x00 if not a weapon)
0018b51c: 000210c0 sll r2,r2,0x03           |r2 = Weapon ID * 8
0018b520: 3c038006 lui r3,0x8006            |
0018b524: 24633ab8 addiu r3,r3,0x3ab8       |r3 = Start of weapons data 2 
0018b528: 0c017895 jal 0x0005e254           |--> Store_X_Byte_into_Y  - Store used ability data 2 into current ability data section (r5) from 0x801938f0 to 0x801938fd  (If > Hi-potion all fields are set to 0x00)
0018b52c: 00438821 addu r17,r2,r3           |r17 = Start of Used weapon Data 2 
0018b530: 02202021 addu r4,r17,r0           |r4 = r17 (preparing next jal)
0018b534: 26050026 addiu r5,r16,0x0026      |r5 = 0x801938FE (start of weapon section in current ability section)
0018b538: 0c017895 jal 0x0005e254           |-->  Store_X_Byte_into_Y - Store equiped/used weapon data into weapon's current ability data section (from 0x801938fe to 0x80193905) (data from item 0x00 if not a weapon)
0018b53c: 34060008 ori r6,r0,0x0008         |r6 = 0x08
0018b540: 92240007 lbu r4,0x0007(r17)       |r4 = Inflict Status/Cast Spell ID from used Weapon data
0018b544: 3c038019 lui r3,0x8019            |
0018b548: 8c632d94 lw r3,0x2d94(r3)         |r3 = Attacker Data location
0018b54c: 34020001 ori r2,r0,0x0001         |r2 = 1
0018b550: 3c018019 lui r1,0x8019            |
0018b554: a02038e4 sb r0,0x38e4(r1)         |Store current ability Charge Power to 0  at 0x801938e4
0018b558: 3c018019 lui r1,0x8019            |
0018b55c: a02238e5 sb r2,0x38e5(r1)         |Store current ability Formula as 0x01  at 0x801938e5
0018b560: 3c018019 lui r1,0x8019            |
0018b564: a02438da sb r4,0x38da(r1)         |Store Weapon's proc ID  in current ability data proc ID at 801938da
0018b568: 90620026 lbu r2,0x0026(r3)        |r2 =  Attacker's Faith
0018b56c: 3c038019 lui r3,0x8019            |
0018b570: 8c632d98 lw r3,0x2d98(r3)         |r3 =  Defender Data location
0018b574: 3c018019 lui r1,0x8019            |
0018b578: a02238d3 sb r2,0x38d3(r1)         | Store Attacker's Faith in current data section (without faith/innocent check)  at 0x801938d3
0018b57c: 90620026 lbu r2,0x0026(r3)        |r2 = Defender's Faith
0018b580: 3c018019 lui r1,0x8019            |
0018b584: a02238d2 sb r2,0x38d2(r1)         |Store Defender's Faith in current data section (without faith/innocent check)  at 0x801938d2
0018b588: 0c062b7d jal 0x0018adf4           |--> Action_data_nulling  (nullify most of current TCAD and ACAP data / set hit% at 100%  - Hit flag at 0x01 for target, at 0x00 for attacker)
0018b58c: 00000000 nop                      |
0018b590: 93a20011 lbu r2,0x0011(r29)       |r2 = Attacker last used skillset (Attacker 0x16f)
0018b594: 3c038019 lui r3,0x8019            |
0018b598: 946338c8 lhu r3,0x38c8(r3)        |r3 = ??   set to 0x00 if elemental nullification, to 0x01 if reaction/proc (maybe host something like"reactable" action)
0018b59c: 3c018019 lui r1,0x8019            |
0018b5a0: a02238d4 sb r2,0x38d4(r1)         |Store r2 in current ability data last used skillset  at 0x801938d4
0018b5a4: 304200ff andi r2,r2,0x00ff        |
0018b5a8: 3c018006 lui r1,0x8006            |
0018b5ac: 00220821 addu r1,r1,r2            |r1 = 0x800600XX (XX = last used skill set)
0018b5b0: 90325cb4 lbu r18,0x5cb4(r1)       |r18 = Action Menu of used skillset
0018b5b4: 10600009 beq r3,r0,0x0018b5dc     #If  0x801938c8 <> 0x00 (Reaction ? Proc ?) Will switch Ability ID with reaction ID (0x801938c6)
0018b5b8: 00000000 nop                           | 
0018b5bc: 3c028019 lui r2,0x8019                 | 
0018b5c0: 944238c6 lhu r2,0x38c6(r2)             |r2 = current ability reaction byte  Load (reaction ID? this halfword seems to handle all post-attack results...)
0018b5c4: 00000000 nop                           |     
0018b5c8: a7a20012 sh r2,0x0012(r29)             |Store Reaction ID as Attacker used ability ID on stack  
0018b5cc: 3c018019 lui r1,0x8019                 |
0018b5d0: a42238d6 sh r2,0x38d6(r1)              |Store Reaction ID as current ability used ability ID (Proc ? Reaction ?)
0018b5d4: 08062d79 j 0x0018b5e4                  >>jump after Else
0018b5d8: 00009021 addu r18,r0,r0                |r18 = 0x00 - Clear Action Menu ID to default
0018b5dc: 3c018019 lui r1,0x8019            #Else
0018b5e0: a42038c6 sh r0,0x38c6(r1)              |Set current ability Reaction ID to 0x00 
0018b5e4: 87a30012 lh r3,0x0012(r29)        |r3 =attacker used ability ID  (attacker 0x170 if not modified above)
0018b5e8: 3c028006 lui r2,0x8006            |
0018b5ec: 2442ebf0 addiu r2,r2,0xebf0       |r2 = Start of abilities data 1
0018b5f0: 000318c0 sll r3,r3,0x03           |r3 = r3 * 8 (ability ID * 8)
0018b5f4: 00621821 addu r3,r3,r2            |r3 = Ability (by ID) start of data 1 
0018b5f8: 90620004 lbu r2,0x0004(r3)        |r2 = used ability First set of AI Flags
0018b5fc: 3c048019 lui r4,0x8019            |
0018b600: 8c842d90 lw r4,0x2d90(r4)         |r4 = Target current action data pointer
0018b604: 30420003 andi r2,r2,0x0003        |r2 = focus on target allies or target ennemies flags
0018b608: a0820018 sb r2,0x0018(r4)         |Store Abilities AI Target Enemies/Allies into 0x18 of Current Action Data (positive spells 'miss,' negative spells are 'guarded'!)
0018b60c: 90620007 lbu r2,0x0007(r3)        |r2 = Used ability evade with motion byte
0018b610: 00000000 nop                      |
0018b614: 30420001 andi r2,r2,0x0001        |r2 = 0x01 if evade with motion is checked - else 0x00
0018b618: 10400009 beq r2,r0,0x0018b640     # If Evade with motion is checked 
0018b61c: 324300ff andi r3,r18,0x00ff       |r3 = Action Menu ID
0018b620: 3c038019 lui r3,0x8019                 |      
0018b624: 8c632d90 lw r3,0x2d90(r3)              |r3 = Target current action data pointer
0018b628: 00000000 nop                           |
0018b62c: 90620018 lbu r2,0x0018(r3)             |r2 = TCADP 0x18  & 'missed' or 'guarded' byte (positive attack vs negative attack)
0018b630: 00000000 nop                           |
0018b634: 24420080 addiu r2,r2,0x0080            |update r2 with 0x80 if evade with motion is checked
0018b638: a0620018 sb r2,0x0018(r3)              |store updated byte in Target current action 0x18
0018b63c: 324300ff andi r3,r18,0x00ff            |r3 = Action Menu ID
0018b640: 34020007 ori r2,r0,0x0007         |r2 = 0x07
0018b644: 14620006 bne r3,r2,0x0018b660     #if action menu = katana inventory 
0018b648: 2c62000b sltiu r2,r3,0x000b       |r2 = 0x01 if action menu < 0x0b (is not Defend or Equip Change or blank or unknow
0018b64c: 93a20018 lbu r2,0x0018(r29)            |r2 = Attacker used Item ID (Attacker 0x0176)
0018b650: 00000000 nop                           |
0018b654: 24420026 addiu r2,r2,0x0026            |r2 = Item ID +0x26  (the displacement of katana ID  from their associated abilities ID)
0018b658: a7a20012 sh r2,0x0012(r29)             |Store r2 as attacker used ability ID (on stack)
0018b65c: 2c62000b sltiu r2,r3,0x000b            |r2 = 0x01 if action menu < 0x0b (is not Defend or Equip Change or blank or unknow
0018b660: 10400095 beq r2,r0,0x0018b8b8     #If action menu is not defend / equip change / blank   /Else jump to dedicated section
0018b664: 00031080 sll r2,r3,0x02                |r2 = action menu * 4 (word)
0018b668: 3c018017 lui r1,0x8017                 |
0018b66c: 00220821 addu r1,r1,r2                 |r1 = 8017XXXX (XXXX = action menu * 4)
0018b670: 8c224344 lw r2,0x4344(r1)              |Load jump addresses for action menu (AM) /Action_menu_return_address_(pre_formula_set_up)
0018b674: 00000000 nop                           |
0018b678: 00400008 jr r2                         >>jump to location specified by the above table
0018b67c: 00000000 nop                           |

                                            --GEOMANCY SECTION--
0018b680: 3c048019 lui r4,0x8019                 |
0018b684: 8c842d94 lw r4,0x2d94(r4)              |r4 =  Attacker Data pointer
0018b688: 0c05fcb6 jal 0x0017f2d8                |--> Get_Elemental_Ability_ID Attacker Tile ID to geomancy skill hard-coding (return r2 = Ability ID)
0018b68c: 00000000 nop                           |
0018b690: a7a20012 sh r2,0x0012(r29)             |Store r2 as attacker last used ability  (On stack)

                                            --DEFAULT, MATH, MONSTER, KATANA -- (And Geomancy)
0018b694: 87a20012 lh r2,0x0012(r29)             |r2 = Attacker last used ability 
0018b698: 00000000 nop                           |
0018b69c: 28420171 slti r2,r2,0x0171             |r2 = 0x01 if ability <= Potion / Else 0x00   
0018b6a0: 10400086 beq r2,r0,0x0018b8bc          #If Ability <= Potion  Else branch after action menu sections (formula will be 0x01)
0018b6a4: 34100001 ori r16,r0,0x0001             |r16 = 0x01 (will become formula)
0018b6a8: 3c028019 lui r2,0x8019                 |
0018b6ac: 8c422d94 lw r2,0x2d94(r2                   |r2 = Attacker Data Pointer
0018b6b0: 00000000 nop                               |
0018b6b4: 9042005a lbu r2,0x005a(r2)                 |r2 = Attacker Third set of Current Status
0018b6b8: 00000000 nop                               |
0018b6bc: 30420002 andi r2,r2,0x0002                 |r2 = 0x02 if Attacker is a Frog / Else 0x00
0018b6c0: 1040000d beq r2,r0,0x0018b6f8              #If Attacker is a frog (which Action menu ?) 
0018b6c4: 00000000 nop                                   | 
0018b6c8: 3c058019 lui r5,0x8019                         | 
0018b6cc: 24a538c8 addiu r5,r5,0x38c8                    |r5 = 801938c8 (Current ability ? Flag - Deals with reaction ? Proc ? - to be checked)
0018b6d0: 94a20000 lhu r2,0x0000(r5)                     |r2 = halfword at 0x801938c8 (reaction ? Proc ?)
0018b6d4: 00000000 nop                                   |
0018b6d8: 14400007 bne r2,r0,0x0018b6f8                      #If r2= 0x00 (no reaction ? Attack nullified ?)
0018b6dc: 24a50036 addiu r5,r5,0x0036                            |0x801938c8 + 0x36 = 801938fe = current ability weapon range location
0018b6e0: 3c018019 lui r1,0x8019                                 |
0018b6e4: a02038d8 sb r0,0x38d8(r1)                              |Current ability used weapon ID = 0x00 (when frog and x38c8 = 0x00)
0018b6e8: 3c048006 lui r4,0x8006                                 |
0018b6ec: 24843ab8 addiu r4,r4,0x3ab8                            |r4 = 0x80063ab8 = Weapons Secondary Data start
0018b6f0: 0c017895 jal 0x0005e254                                |--> Store_X_Byte_into_Y   Store data from the null weapon (fists) into 0x801938fe - 0x80193905 (current ability weapon section)
0018b6f4: 34060008 ori r6,r0,0x0008                              |r6 = 0x08 (for Jal above)
0018b6f8: 3c058019 lui r5,0x8019                     | 
0018b6fc: 24a538f0 addiu r5,r5,0x38f0                |r5 = 0x801938f0 - Current ability : ability range adress (prepare jal at 0x8018b720)
0018b700: 87a20012 lh r2,0x0012(r29)                 |r2 = Attacker last used ability (on stack)
0018b704: 3406000e ori r6,r0,0x000e                  |r6 = 0x0e (limit for 0x8018b720)
0018b708: 000280c0 sll r16,r2,0x03                   |r16 = r2 * 8 (Ability ID * 8)
0018b70c: 02028023 subu r16,r16,r2                   |r16 = ID * 7
0018b710: 00108040 sll r16,r16,0x01                  |r16 = ID * 14
0018b714: 3c028006 lui r2,0x8006                     |
0018b718: 2442fbf0 addiu r2,r2-0x0410                |r2 = 0x8005fbf0 (start of abilities data 2)
0018b71c: 02028021 addu r16,r16,r2                   |r16 = last used ability data 2 location for ability ID
0018b720: 0c017895 jal 0x0005e254                    |--> Store_X_Byte_into_Y  Store ability data 2 into 0x801938f0 - 0x801938fd (update for geomancy, katana and reaction)
0018b724: 02002021 addu r4,r16,r0                    |r4 = r16 (ability data 2 location for above jal )
0018b728: 9202000b lbu r2,0x000b(r16)                |r2 = Load Ability Inflict Status ID (from ability table)
0018b72c: 3c018019 lui r1,0x8019                     |
0018b730: a02238da sb r2,0x38da(r1)                  |Store status proc ID in current ability data section
0018b734: 3c028019 lui r2,0x8019                     |
0018b738: 904238f3 lbu r2,0x38f3(r2)                 |r2 = Current ability ability : ability flags 1
0018b73c: 92100008 lbu r16,0x0008(r16)               |r16 = Ability Formula (from ability table)
0018b740: 30420024 andi r2,r2,0x0024                 |r2 = check result for "weapon strike" and "ranged weapon" flags
0018b744: 1440005e bne r2,r0,0x0018b8c0              # If weapon strike and ranged weapon are not checked   Else branch after the action menu sections
0018b748: 320200ff andi r2,r16,0x00ff                |r2 = Ability formula (= r16)
0018b74c: 324300ff andi r3,r18,0x00ff                    |r3 = Action Menu of used skillset
0018b750: 34020007 ori r2,r0,0x0007                      |r2 = 0x07
0018b754: 1062005a beq r3,r2,0x0018b8c0                  #If action menu <> Katana inventory   Else branch after the action menu sections
0018b758: 320200ff andi r2,r16,0x00ff                    |r2 = Ability formula 
0018b75c: 3c018019 lui r1,0x8019                             | 
0018b760: a02038d8 sb r0,0x38d8(r1)                          |Store current ability Used Weapon ID as 0x00 (not ranged weapon - not weapon strike - not draw out)
0018b764: 08062e2f j 0x0018b8bc                              >> Jump after action menu section
0018b768: 00000000 nop                                       |

                                            --ITEM---
0018b76c: 93a70018 lbu r7,0x0018(r29)            |r7 = Attacker used Item/Weapon ID 
0018b770: 00000000 nop                           |
0018b774: 2ce200f0 sltiu r2,r7,0x00f0            |r2 = 0x01 if Item used is < at Potion / Else 0x00
0018b778: 14400050 bne r2,r0,0x0018b8bc          # If Attacker used item ID >= Potion ID /Else branch after action menu section (with formula = 0x01)
0018b77c: 34100001 ori r16,r0,0x0001             |r16 = 0x01
0018b780: 3c048019 lui r4,0x8019                     | 
0018b784: 248438d8 addiu r4,r4,0x38d8                |r4 = Current ability Used Weapon ID location (0x801938d8)
0018b788: a0870000 sb r7,0x0000(r4)                  |Store used item ID in Current ability Used weapon ID
0018b78c: 24e70010 addiu r7,r7,0x0010                |r7 = Used Item ID + 0x10
0018b790: 24840018 addiu r4,r4,0x0018                |r4 = Current ability - Ability range location (0x801938f0)
0018b794: 30e200ff andi r2,r7,0x00ff                 |r2 = r7 last byte (Used item ID + 0x10 : for potion F0 +0x10 = 0x100 then 0x0100 and 0x00FF = 0x00)
0018b798: 00028040 sll r16,r2,0x01                   |r16 = r7*2
0018b79c: 02028021 addu r16,r16,r2                   |r16 = r7*3  / 0x00 (for potion) to 0x27 (for phoenix down)
0018b7a0: 3c028006 lui r2,0x8006                     |
0018b7a4: 24423f98 addiu r2,r2,0x3f98                |r2 = 0x80063f98 potion Secondary Data Table
0018b7a8: 02028021 addu r16,r16,r2                   |r16 = 0x80063f98 + (0x00 to 0x27) = Used item secondary data table adress
0018b7ac: 3c018019 lui r1,0x8019                     |
0018b7b0: a02738db sb r7,0x38db(r1)                  |Store r7 last byte current ability used Item ID (0x00 to 0x0d)
0018b7b4: 92020002 lbu r2,0x0002(r16)                |r2 = used Item's inflicted Status
0018b7b8: 3c018019 lui r1,0x8019                     |
0018b7bc: a02238da sb r2,0x38da(r1)                  |Store status proc of used item in current ability status proc
0018b7c0: 0c017991 jal 0x0005e644                    |--> Data_Nullifying  nullify data from r4 (Current ability range) to r4 + r5 (0x801938fd ability MP Cost)
0018b7c4: 3405000e ori r5,r0,0x000e                  |r5 = 0x0e (limit)
0018b7c8: 92100000 lbu r16,0x0000(r16)               |r16 = used Item formula
0018b7cc: 08062e30 j 0x0018b8c0                      >>Jump after action menu sections
0018b7d0: 320200ff andi r2,r16,0x00ff                |r2 = used Item formula

                                            --THROW--
0018b7d4: 08062e2f j 0x0018b8bc                  >> Jump after action menu sections with formula = 0x63
0018b7d8: 34100063 ori r16,r0,0x0063             |r16 = 0x63

                                            --JUMP--
0018b7dc: 08062e2f j 0x0018b8bc                  >> Jump after action menu sections with formula = 0x64
0018b7e0: 34100064 ori r16,r0,0x0064             |r16 = 0x64

                                            --CHARGE--
0018b7e4: 97a30012 lhu r3,0x0012(r29)            |r3 = Attacker last used ability ID
0018b7e8: 00000000 nop                           |
0018b7ec: 2462fe6a addiu r2,r3,-0x0196           |r2 = ability ID - 196  (Note : Charge+1 ID = 0x0196)
0018b7f0: 2c420008 sltiu r2,r2,0x0008            |r2 =0x01 if used attack is a charge+x ability
0018b7f4: 14400003 bne r2,r0,0x0018b804          #If Used ability is not a charge ability
0018b7f8: 00031040 sll r2,r3,0x01                |r2 = r3*2 (charge + x ID*2)
0018b7fc: 34030196 ori r3,r0,0x0196                  |r3 = 0x0196 (Charge + 1 ID)
0018b800: 00031040 sll r2,r3,0x01                    |r2 = charge+1 ID *2
0018b804: 3c018006 lui r1,0x8006                     |
0018b808: 00220821 addu r1,r1,r2                 |r1 = 8006XXXX (XXXX = Ability ID * 2)
0018b80c: 90220d19 lbu r2,0x0d19(r1)             |r2 = Charge Power boost (using ability ID... maths checked in patcher)
0018b810: 3c018019 lui r1,0x8019                 |
0018b814: a02238e4 sb r2,0x38e4(r1)              |Store Charge Power boost in current ability charge power(0x801938e4)

                                            --ATTACK / CHARGE--
0018b818: 3c028019 lui r2,0x8019                 |
0018b81c: 904238ff lbu r2,0x38ff(r2)             |r2 = current ability Weapon Characteristics
0018b820: 92300002 lbu r16,0x0002(r17)           |r16 = used weapon formula   (r17 = start of used weapon data 2  - see 0018b52c)
0018b824: 30420004 andi r2,r2,0x0004             |r2 = 0x04 if weapon used is available to 2 hands - Else 0x00
0018b828: 10400025 beq r2,r0,0x0018b8c0          #If used weapon is 2 hands compatible # /Else jump after action menu section
0018b82c: 320200ff andi r2,r16,0x00ff            |r2 = used weapon formula
0018b830: 3c038019 lui r3,0x8019                     | 
0018b834: 8c632d94 lw r3,0x2d94(r3)                  |r3 = Attacker's Data pointer
0018b838: 00000000 nop                               |
0018b83c: 90620091 lbu r2,0x0091(r3)                 |r2 = Attacker third set of support
0018b840: 00000000 nop                               |
0018b844: 30420002 andi r2,r2,0x0002                 |r2 = 0x02 if using two hands / else 0x00
0018b848: 1040001c beq r2,r0,0x0018b8bc              #If attacker is using two hands # / else jump after action menu section
0018b84c: 340200ff ori r2,r0,0x00ff                      |r2 = 0xff
0018b850: 9064001d lbu r4,0x001d(r3)                     |r4 = Attacker Right Hand Weapon ID
0018b854: 00000000 nop                                   |
0018b858: 14820009 bne r4,r2,0x0018b880                  #If weapon ID = 0xFF (do not exist ? 2Hands flag ?)
0018b85c: 00000000 nop                                       | 
0018b860: 9062001e lbu r2,0x001e(r3)                         |r2 = right hand shield
0018b864: 00000000 nop                                       |
0018b868: 14440005 bne r2,r4,0x0018b880                      #If right hand shield ID = right weapon ID (is 0xFF) #Shield do not exist
0018b86c: 34020001 ori r2,r0,0x0001                              |r2 = 0x01
0018b870: 3c018019 lui r1,0x8019                                 |
0018b874: a02238d9 sb r2,0x38d9(r1)                              |Store 0x01 at  current ability 0x801938d9 flag (Two Hands is active)
0018b878: 3c038019 lui r3,0x8019                                 |
0018b87c: 8c632d94 lw r3,0x2d94(r3)                      |r3 = Attacker's Data pointer
0018b880: 00000000 nop                                   |
0018b884: 9064001f lbu r4,0x001f(r3)                     |r4 = Left Hand Weapon ID
0018b888: 340200ff ori r2,r0,0x00ff                      |r2 = 0xFF
0018b88c: 1482000c bne r4,r2,0x0018b8c0                  #If Left hand weapon ID = 0xFF (do not exist) /Else branch after action menu sections
0018b890: 320200ff andi r2,r16,0x00ff                    |r2 = used weapon formula 
0018b894: 90620020 lbu r2,0x0020(r3)                         |r2 = Left hand shield
0018b898: 00000000 nop                                       |
0018b89c: 14440008 bne r2,r4,0x0018b8c0                      #If Left hand shield ID = 0xFF (Shield do not exist) /Else branch after action menu sections
0018b8a0: 320200ff andi r2,r16,0x00ff                        |r2 = used weapon formula 
0018b8a4: 34020001 ori r2,r0,0x0001                              |r2 = 0x01
0018b8a8: 3c018019 lui r1,0x8019                                 |
0018b8ac: a02238d9 sb r2,0x38d9(r1)                              |Store 0x01 at  current ability 0x801938d9 flag (Two Hands is active)
0018b8b0: 08062e30 j 0x0018b8c0                                  >> Jump after action menu sections
0018b8b4: 320200ff andi r2,r16,0x00ff                            |r2 = Weapon formula

                                            -- BLANK / DEFEND / EQUIP CHANGE --
0018b8b8: 34100001 ori r16,r0,0x0001             |r16 = 0x01 formula for equip change is 0x01
0018b8bc: 320200ff andi r2,r16,0x00ff            |r2 = r16 (future ability formula)

0018b8c0: 3c018019 lui r1,0x8019                 |
0018b8c4: a42038c8 sh r0,0x38c8(r1)         |Store 0x00 in current ability 0x38c8 (reaction flag ?)
0018b8c8: 3c018019 lui r1,0x8019            |
0018b8cc: a02038ed sb r0,0x38ed(r1)         |Store 0x00 in current ability 0x38ed (fall related ? poach ?) /// Zero post-attack effects (not poach or fall damage?)
0018b8d0: 10400003 beq r2,r0,0x0018b8e0     #If future formula ID is not 0x00 /Else branch to force formula ID to be 0x01
0018b8d4: 2c420065 sltiu r2,r2,0x0065            |r2 = 0x01 if formula ID <= 0x64 / Else 0x00
0018b8d8: 14400002 bne r2,r0,0x0018b8e4          #If formula ID > 0x64  /Else branch avoiding formula beeing set to 0x01
0018b8dc: 00000000 nop                               | 
0018b8e0: 34100001 ori r16,r0,0x0001        #ELSE (formula is 0x00) r16 = 0x01 (if formula = 0x00 or > 0x64)
0018b8e4: 3c058019 lui r5,0x8019            |
0018b8e8: 24a538da addiu r5,r5,0x38da       |r5 = 0x801938da (Current Ability proc ID)
0018b8ec: 90a70000 lbu r7,0x0000(r5)        |r7 = Ability/Weapon proc ID 
0018b8f0: 321100ff andi r17,r16,0x00ff      |r17 = Ability formula
0018b8f4: 34020003 ori r2,r0,0x0003         |r2 = 0x03
0018b8f8: 16220002 bne r17,r2,0x0018b904    #If Formula = 0x03 
0018b8fc: 24a5002c addiu r5,r5,0x002c       |r5 = 0x80193906 (inflicting status type location)
0018b900: 00003821 addu r7,r0,r0                 |r7 = 0x00 (Force status ID to 0x00 for formula 0x03)
0018b904: 30e200ff andi r2,r7,0x00ff        |r2 = Current Ability proc ID
0018b908: 00022040 sll r4,r2,0x01           |r4 = r2 * 2
0018b90c: 00822021 addu r4,r4,r2            |r4 = r2*3
0018b910: 00042040 sll r4,r4,0x01           |r4 = r2*6 (Proc ID *6)
0018b914: 3c028006 lui r2,0x8006            |
0018b918: 24423fc4 addiu r2,r2,0x3fc4       |r2 = 0x80063fc4 (Start of inflict statuses table)
0018b91c: 00822021 addu r4,r4,r2            |r4 = start of Current Ability Status Proc ID Table
0018b920: 0c017895 jal 0x0005e254           |--> Store_X_Byte_into_Y  Store Status data in current ability  at 0x80193906 - 0x8019390b
0018b924: 34060006 ori r6,r0,0x0006         |r6 = 0x06 (limit for above)
0018b928: 0c062e7e jal 0x0018b9f8           |--> Remove_Status  if status type is cancel - store statuses set from status ID at 0x80193860 to 0x80193864 
0018b92c: 00000000 nop                      | -- Note: Can cause issues if repurposing the Inflict Status byte in a formula. See Formulas for more info.
0018b930: 3c018019 lui r1,0x8019            |
0018b934: a03038e5 sb r16,0x38e5(r1)        |Store r16 in current Ability formula
0018b938: 0c063279 jal 0x0018c9e4           |--> %27Reflect%27,_Blade_Grasp,_and_Arrow_Guard   - Set target current action hit flag to 0x00 if succeed
0018b93c: 00000000 nop                      |
0018b940: 3c028019 lui r2,0x8019            |
0018b944: 8c422d90 lw r2,0x2d90(r2)         |r2 = Target Current Action Data Pointer
0018b948: 00000000 nop                      |
0018b94c: 90420000 lbu r2,0x0000(r2)        |r2 = Target Current Action Hit Flag
0018b950: 00000000 nop                      |
0018b954: 14400003 bne r2,r0,0x0018b964     #If Attack missed (from reflect / blade grasp / arrow guard) /Else avoid the jump to end
0018b958: 00111080 sll r2,r17,0x02          |r2 = Ability formula ID * 4
0018b95c: 08062e77 j 0x0018b9dc                  >> Jump to END! With r2=0x01
0018b960: 34020001 ori r2,r0,0x0001              |r2 = 0x01
0018b964: 3c018019 lui r1,0x8019            | 
0018b968: 00220821 addu r1,r1,r2            |r1 = 0x801900xx (xx = Formula ID*4)
0018b96c: 8c22f610 lw r2,-0x09f0(r1)        |Load Formula routine adress / from Formula_Table
0018b970: 00000000 nop                      |
0018b974: 0040f809 jalr r2,r31              |--> Jumps to appropriate formula routine /Formulas
0018b978: 00000000 nop                      |
0018b97c: 2e220007 sltiu r2,r17,0x0007      |r2 = 0x01 if formula ID <= 0x06
0018b980: 10400004 beq r2,r0,0x0018b994     #If formula ID <= 0x06
0018b984: 34020064 ori r2,r0,0x0064         |r2 = 0x64
0018b988: 0c061f28 jal 0x00187ca0                |--> Formula_01_-_06_Aftermath  (Contains poach and secret hunt)
0018b98c: 00000000 nop                           |
0018b990: 34020064 ori r2,r0,0x0064              |r2 = 0x64
0018b994: 16220003 bne r17,r2,0x0018b9a4    #If Formula ID = 0x64  (jump)
0018b998: 00000000 nop                           |  
0018b99c: 3c018019 lui r1,0x8019                 |  
0018b9a0: a02038d8 sb r0,0x38d8(r1)              |Store 0x00 in Current ability used weapon ID (0x801938d8)
0018b9a4: 0c062e91 jal 0x0018ba44           |-->Set_some_data_for_current_attack
0018b9a8: 00000000 nop                      |
0018b9ac: 3c038019 lui r3,0x8019            |
0018b9b0: 8c632d90 lw r3,0x2d90(r3)         |r3 = Target Current Action Data Pointer
0018b9b4: 00000000 nop                      |
0018b9b8: 94620010 lhu r2,0x0010(r3)        |r2 = Target Current Action Special Action Flags
0018b9bc: 00000000 nop                      |
0018b9c0: 10400006 beq r2,r0,0x0018b9dc     #If There are specials flags 
0018b9c4: 00001021 addu r2,r0,r0            |r2 = 0x00 
0018b9c8: 90620025 lbu r2,0x0025(r3)             |r2 = Target Current Action attack-type
0018b9cc: 00000000 nop                           |
0018b9d0: 34420001 ori r2,r2,0x0001              |Update r2 with 0x01
0018b9d4: a0620025 sb r2,0x0025(r3)              |Store target current action attack-type as Pseudo-Status change
0018b9d8: 00001021 addu r2,r0,r0                 |r2 = 0x00
0018b9dc: 8fbf0034 lw r31,0x0034(r29)       |End
0018b9e0: 8fb20030 lw r18,0x0030(r29)       
0018b9e4: 8fb1002c lw r17,0x002c(r29)       
0018b9e8: 8fb00028 lw r16,0x0028(r29)       
0018b9ec: 27bd0038 addiu r29,r29,0x0038     
0018b9f0: 03e00008 jr r31                   
0018b9f4: 00000000 nop

Return Locations:

0017d0bc: Main ability loading routine?
0017f284: Calculate Projected Action Effect
0018ada8: Double WP if two hands is equipped?

Summary

Pre Formula routine will set a bunch of current ability data mainly based on skillset 
and reset most of the  Attacker and target current action before jumping into formula section.
 
In all cases 
   0x80192d98 - Store Target data pointer (from 0x801908cc based on target ID)
   0x80192d90 - Store Target current action data pointer (Target data +0x01c0)
   0x80192d8c - Store 0x80192da0 (copy of Attacker action data)
   0x80192d94 - Store Attacker data pointer (from 0x801908cc based on unit ID)
 
   Current Ability Data
   0x801938c1 - Store Target ID
   0x801938c0 - Store Attacker ID
   0x8019390e - Store 0x00 in post formula flags (deal with poach and train)
 
Then two shortcut's to end
   Reaction Fork - if reacting (0x8019f5f0 = 0x01) with a non-counter non-guard ability (cf Perform_reaction_abilities)
       Play the reactions ability 	
       Store data at 0x801938d8 via Store_used_weapon
       Exit routine 
							
   Fall Damage fork - Check value at 0x801938ed if 0x80 is enabled deal with fall damage and exit (cf Knockback?)
 
 
Main stream
   Store a bunch of data in current ability section - depending on action menu, skillset and ability ID

   0x801938c6 - Reaction ID : set to 0x00 if 0x801938c8 = 0x00
   0x801938c8 - Set to 0x00 after the big action menu section (before that it's used several times in the routine)
   0x801938cd - Store Target terrain type
   0x801938d2 - Store target's faith
   0x801938d3 - Store attacker's faith
   0x801938d4 - Store used ability skillset (from attacker data 0x16f)
   0x801938d6 - Store used ability ID :
                  - By default from attacker data 0x170
                  - If 0x801938c8 <> 0x00 : take the value of 0x801938c6 (reaction ID)
                  - If Action menu is katana inventory : store used item ID (attacker data 0x176) + 0x26
                                                         (Katana ID + 0x26 = Ability ID corresponding to katana)
                  - If Action menu is element : Ability ID is hardcoded from Attacker terrain type (cf Get_Elemental_Ability_ID)

   0x801938d8 - Store used weapon ID	
                  - Right hand weapon if 0x801938c3 = 0x00
                  - Left hand weapon if 0x801938c3 <> 0x00
                  - Used Item ID if Attacker last used skillset is drawout (Attacker data 0x016f = 0x13)
                  - Set to 0x00 if ID of the three cases above is >= 80 (not a weapon)						
                  - Set to 0x00 if default action menu, target is frog and 801938c8 = 0x00 (...)
                  - Set to 0x00 if action menu = geomancy/default/monster/math and neither weapon strike nor wepon range are checked ( 0x801938f3 )
                  - Used item ID (from attacker data 0x176) if action menu is item inventory
                  - Set to 0x00 after jump to formula if formula was 0x64 (jump abilities)

   0x801938d9 - By default, set to 0x00
                  - Set to 0x01 if : - action menu is attack or charge
                                       and ability used weapon is compatible with two hands (0x801938ff has 0x04 enabled)
                                       and attacker use two-hands (Attacker data 0x91 has 0x02 enabled)
                                       and one of the Attacker hands has Weapon AND shield ID = 0xFF (Attacker datas 0x1d, 0x1e,0x1f,0x20)

   0x801938da - Store ability proc ID	:
                  - Weapon Proc ID by default (from used weapon data table) (before action menu section)
                  - Ability proc ID if action menu is geomancy/katana/default/monster/math

   0x801938db - Store used item ID if action menu is item inventory. Values from 0x00 (potion) to 0x0D (phoenix down)	
   0x801938e4 - Store charge power :
                  - By default to 0x00 (before action menu section)
                  - If action menu is charge :
                        - if ability ID is between 0x196 and 0x19D : store ability charge power
                        - if not a charge ability, charge power is 0x196 charge power

   0x801938e5 - Store ability formula :
                  - By default set to 0x01 (defore action menu)	
                  - If action menu is geomancy/katana/default/monster/math :
                      - if Ability ID > potion : set to 0x01
                      - if ability ID <= potion : set to ability formula (from ability ID via SCUS table)
                  - If action menu is item inventory : set to item formula (from item ID via Item SCUS table)
                  - If action menu is weapon inventory (throw) force formula to 0x63
                  - If action menu is jump : force formula to 0x64
                  - If action menu is charge/attack : set to weapon formula (from SCUS via used weapon ID)
                  - If action menu is blank/defend/equip change set to 0x01
                  - If formula is > 0x64 : forced to 0x01

   0x801938ed - Set to 0x00 if fall dmg Knockback?)
              - Set to 0x00 after action menu section
   Ability data		   
   0x801938f0 to 0x801938fd - Store ability data 
              - by default From Ability ID via SCUS ability table 
              - If Ability ID > potion : store ability 0x00 data
              - If action menu is item inventory, nullify the bytes

   Weapon data
   0x801938fe to 0x80193905
              - by default from weapon ID via SCUS item table
              - If used weapon have an ID >= 80 store item 0x00 data
              - if action menu is geomancy/katana/default/monster/math, and attacker has frog and 0x801938c8 = 0x00 store item 0x00 data

   Status data
   0x80193906 to 0x8019390b - store status data :
              - from 0x801938da ID (weapon or ability proc - see above) via SCUS table
              - if formula = 0x03 store Status 0x00 SCUS data (?) 

   0x80193860 to 0x80193864 - Store status to cancel (is 0x80193906 has cancel enabled) Remove_Status

   Current action data
   - reset most of attacker and target current action data via Action_data_nulling
       - preserve unit reaction ID and last attack recieved
       - set current target action hit flag to 'hit' and attacker's one to 'miss'
       - set both hit% to 100%
					
   Test blade grasp - reflect and arrow guard 'Reflect',_Blade_Grasp,_and_Arrow_Guard
       - If reaction occurs, set target hitflag to 'miss', avoid jal to formula section set r2 = 0x01

Jump to formula 

Post formula not investigated