Difference between revisions of "Chose Move from Move List?"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
(Created page with "<font face='Courier New'> 00197d0c: 00005821 addu r11,r0,r0 00197d10: 00003821 addu r7,r0,r0 00197d14: 340d0001 ori r13,r0,0x0001 00197d18: 3c0c801a lui r12,0x801a 0019...")
 
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
<font face='Courier New'>
+
'''BATTLE.BIN''' : - Chose Move from Move List?
   
+
  Run Simulation for all Abilities in Unit List (AI 0xef0). Best results should be saved from AI 0x54 to AI 0x154
  00197d0c: 00005821 addu r11,r0,r0
+
  ------------------------------------------------------------------------------------------
  00197d10: 00003821 addu r7,r0,r0
+
  Parameter :  
  00197d14: 340d0001 ori r13,r0,0x0001
+
  Return : r2 = 0x00 (default)
  00197d18: 3c0c801a lui r12,0x801a
+
          r2 = -0x01 if Simulation of an ability returns - 0x01
00197d1c: 258cf3c4 addiu r12,r12,0xf3c4
+
  ------------------------------------------------------------------------------------------
  00197d20: 01804821 addu r9,r12,r0
+
  00197e60: 3c02801a lui r2,0x801a            |
  00197d24: 00004021 addu r8,r0,r0
+
  00197e64: 90420d7b lbu r2,0x0d7b(r2)        |{{f/load|AI 0x19b7}} {{f/std|801a0d7b}}
  00197d28: 340a182c ori r10,r0,0x182c
+
  00197e68: 27bdffe8 addiu r29,r29,-0x0018    |
  00197d2c: 018a1821 addu r3,r12,r10 r3 = decision data
+
  00197e6c: afb00010 sw r16,0x0010(r29)       |
  00197d30: a1200c78 sb r0,0x0c78(r9)
+
  00197e70: 3c10801a lui r16,0x801a            |
  00197d34: 90620007 lbu r2,0x0007(r3) load target consideration
+
  00197e74: 2610f3c4 addiu r16,r16,0xf3c4      |{{f/adr|0x8019f3c4}}
  00197d38: 00000000 nop
+
  00197e78: 14400013 bne r2,r0,0x00197ec8      {{f/Cond|If AI 0x19b7 <> 0x00 : branch directly to }} {{f/loc| Simulation }} {{f/std|(Ability is chosen or return where the routine fails ?)}}
00197d3c: 30420010 andi r2,r2,0x0010
+
  00197e7c: afbf0014 sw r31,0x0014(r29)        |
  00197d40: 1440003f bne r2,r0,0x00197e40 branch to next target if target can't be targeted
+
                                              '''<nowiki>Else : AI 0x19b7 = 0x00</nowiki>'''
  00197d44: 00000000 nop
+
  00197e80: 3c01801a lui r1,0x801a                |
  00197d48: 3c018019 lui r1,0x8019
+
  00197e84: a0200081 sb r0,0x0081(r1)              |{{f/store|Initialize Ability counter (at 0x801a0081)}} {{f/std|AI 0x0cbd}}
  00197d4c: 00280821 addu r1,r1,r8
+
                                                {{f/bloop|LOOP - Each Ability}}
  00197d50: 90220925 lbu r2,0x0925(r1) load 59 status
+
  00197e88: 92030e2f lbu r3,0x0e2f(r16)               |{{f/load|Load acting unit ID}}
  00197d54: 00000000 nop
+
  00197e8c: 00000000 nop                               |
  00197d58: 30420010 andi r2,r2,0x0010
+
  00197e90: 00031100 sll r2,r3,0x04                    |
  00197d5c: 14400006 bne r2,r0,0x00197d78 branch if target has confusion
+
  00197e94: 00431021 addu r2,r2,r3                     |
00197d60: 00000000 nop
+
  00197e98: 000210c0 sll r2,r2,0x03                    |{{f/std|ID *0x88}}
00197d64: 90620004 lbu r2,0x0004(r3) load ??
+
  00197e9c: 24420ef0 addiu r2,r2,0x0ef0                |
  00197d68: 00000000 nop
+
  00197ea0: 92030cbd lbu r3,0x0cbd(r16)               |{{f/load|Load Ability counter}}
00197d6c: 30420080 andi r2,r2,0x0080
+
  00197ea4: 02021021 addu r2,r16,r2                   |{{f/adr|0x8019f3c4 + 0x0ef0 + Unit offset}} {{f/std|This unit start of usable abilities list}}
  00197d70: 10400033 beq r2,r0,0x00197e40 branch to next unit if 0x80 is not true
+
  00197ea8: 00031880 sll r3,r3,0x02                    |{{f/std|Ability offset (1 word per ability)}}
  00197d74: 00000000 nop
+
  00197eac: 00432021 addu r4,r2,r3                    |{{f/adr|This Ability pointer}} {{f/std|0x8019f3c4 + 0x0ef0 + Unit offset + Ability offset}}
00197d78: 91820e2e lbu r2,0x0e2e(r12) load acting units ID
+
  00197eb0: 90830002 lbu r3,0x0002(r4)                |{{f/load|Load This Ability skillset}}
  00197d7c: 00000000 nop
+
  00197eb4: 340200ff ori r2,r0,0x00ff                  |
00197d80: 14e20004 bne r7,r2,0x00197d94 branch if considered unit isn't acting unit
+
  00197eb8: 10620011 beq r3,r2,0x00197f00              {{f/Cond|If End of usable Abilities }} {{f/loc|Exit routine}} {{f/Returns|Returns 0x00}}
  00197d84: 34020002 ori r2,r0,0x0002
+
  00197ebc: 00001021 addu r2,r0,r0                    |
  00197d88: 340200ff ori r2,r0,0x00ff
+
  00197ec0: 0c06561e jal 0x00195878                    |{{f/jal|AI_Ability_Data_Setting|AI_Ability_Data_Setting}} {{f/std|Set data at 8019f3c4 (from 0x00 to 0x13)}}
  00197d8c: 10a2002c beq r5,r2,0x00197e40 branch to next unit if r5 = 0xff
+
  00197ec4: 00000000 nop                               |
  00197d90: 34020002 ori r2,r0,0x0002
+
                  {{f/sec|AI 0x19b7 <>0}}
  00197d94: 10820015 beq r4,r2,0x00197dec
+
  00197ec8: 0c066bc6 jal 0x0019af18                    |{{f/jal|AI_Ability_Outcome_Evaluation|AI_Ability_Outcome_Evaluation}} {{f/std|Test All destination and targetable tile with this ability (save results in AI 0x54 Tables)}}
  00197d98: 28820003 slti r2,r4,0x0003
+
  00197ecc: 00000000 nop                              |
  00197d9c: 10400005 beq r2,r0,0x00197db4
+
  00197ed0: 2403ffff addiu r3,r0,-0x0001              |
  00197da0: 00000000 nop
+
  00197ed4: 1043000a beq r2,r3,0x00197f00              {{f/Cond|If returned value is -0x01}} {{f/loc|Exit routine}} {{f/Returns|Returns -0x01}}
  00197da4: 108d000e beq r4,r13,0x00197de0 branch if r4 = 1
+
  00197ed8: 2402ffff addiu r2,r0,-0x0001               |
  00197da8: 00000000 nop
+
  00197edc: 92020cbd lbu r2,0x0cbd(r16)               |{{f/load|Load Current ability counter}}
00197dac: 08065f8f j 0x00197e3c
+
  00197ee0: 00000000 nop                               |
  00197db0: a12d0c78 sb r13,0x0c78(r9) store active unit byte = 1
+
  00197ee4: 24420001 addiu r2,r2,0x0001                |
  00197db4: 34020003 ori r2,r0,0x0003
+
  00197ee8: a2020cbd sb r2,0x0cbd(r16)                 |{{f/store|Increase Ability counter by 0x1}}
  00197db8: 10820005 beq r4,r2,0x00197dd0
+
  00197eec: 92020cbd lbu r2,0x0cbd(r16)               |{{f/load|Load Current ability counter}}
  00197dbc: 34020004 ori r2,r0,0x0004
+
  00197ef0: 00000000 nop                               |
  00197dc0: 10820010 beq r4,r2,0x00197e04
+
  00197ef4: 2c420022 sltiu r2,r2,0x0022                |{{f/std|Check List limit}}
00197dc4: 3c020001 lui r2,0x0001
+
  00197ef8: 1440ffe3 bne r2,r0,0x00197e88          {{f/Cond|Do for all moves}}
  00197dc8: 08065f8f j 0x00197e3c
+
  00197efc: 00001021 addu r2,r0,r0                |{{f/Returns|returns 0x00}}
00197dcc: a12d0c78 sb r13,0x0c78(r9) store active unit byte
+
  00197f00: 8fbf0014 lw r31,0x0014(r29)
00197dd0: 14e5001b bne r7,r5,0x00197e40
+
  00197f04: 8fb00010 lw r16,0x0010(r29)
  00197dd4: 00000000 nop
+
  00197f08: 27bd0018 addiu r29,r29,0x0018
  00197dd8: 08065f8f j 0x00197e3c
+
  00197f0c: 03e00008 jr r31
  00197ddc: a12d0c78 sb r13,0x0c78(r9) store active unit byte
+
  00197f10: 00000000 nop
  00197de0: 90620008 lbu r2,0x0008(r3) load enemy flag
+
===Return locations===
  00197de4: 08065f8c j 0x00197e30
+
  '''BATTLE.BIN'''
00197de8: 00000000 nop
+
  00196258: [[Non-Specific_AI_AutoBattle_(Enemies)]]
  00197dec: 90620008 lbu r2,0x0008(r3) load enemy flag
+
  00198248: [[Fight_for_Life_-_Auto_Battle_(00197ff4)]]
  00197df0: 00000000 nop
+
  00198288: [[Fight_for_Life_-_Auto_Battle_(00197ff4)]]
00197df4: 14400012 bne r2,r0,0x00197e40 branch if enemy
+
  00198750: [[Protect_Allies_-_Auto_Battle_(001984ec)]]
00197df8: 00000000 nop
+
  00198790: [[Protect_Allies_-_Auto_Battle_(001984ec)]]
00197dfc: 08065f8f j 0x00197e3c
+
  001987c8: [[Protect_Allies_-_Auto_Battle_(001984ec)]]
00197e00: a12d0c78 sb r13,0x0c78(r9) store active unit flag
+
  00198f28: [[AI_Critical_or_Run_Like_Rabbit]]
  00197e04: 3c038019 lui r3,0x8019
+
  00199000: [[AI_Critical_or_Run_Like_Rabbit]]
00197e08: 246308cc addiu r3,r3,0x08cc
 
00197e0c: 01033021 addu r6,r8,r3
 
  00197e10: 8cc30058 lw r3,0x0058(r6) load status
 
  00197e14: 34428020 ori r2,r2,0x8020
 
  00197e18: 00621824 and r3,r3,r2
 
  00197e1c: 14600006 bne r3,r0,0x00197e38 branch if dead or petrified
 
  00197e20: 00000000 nop
 
  00197e24: 90c2005c lbu r2,0x005c(r6) load status
 
00197e28: 00000000 nop
 
00197e2c: 30420001 andi r2,r2,0x0001
 
00197e30: 10400003 beq r2,r0,0x00197e40 branch if not death sentence or if ally
 
00197e34: 00000000 nop
 
00197e38: a12d0c78 sb r13,0x0c78(r9) store active unit byte
 
00197e3c: 340b0001 ori r11,r0,0x0001
 
00197e40: 25290001 addiu r9,r9,0x0001 Active unit list++
 
00197e44: 250801c0 addiu r8,r8,0x01c0 unit data++
 
00197e48: 24e70001 addiu r7,r7,0x0001 unitID++
 
00197e4c: 28e20015 slti r2,r7,0x0015
 
00197e50: 1440ffb6 bne r2,r0,0x00197d2c do for all units
 
00197e54: 254a0010 addiu r10,r10,0x0010 Type of target data++
 
00197e58: 03e00008 jr r31
 
00197e5c: 01601021 addu r2,r11,r0
 
</font>
 

Latest revision as of 19:40, 16 June 2024

BATTLE.BIN :  - Chose Move from Move List? 
Run Simulation for all Abilities in Unit List (AI 0xef0). Best results should be saved from AI 0x54 to AI 0x154
------------------------------------------------------------------------------------------
Parameter : 
Return : r2 = 0x00 (default)
         r2 = -0x01 if Simulation of an ability returns - 0x01
------------------------------------------------------------------------------------------
00197e60: 3c02801a lui r2,0x801a             |
00197e64: 90420d7b lbu r2,0x0d7b(r2)         |AI 0x19b7 801a0d7b
00197e68: 27bdffe8 addiu r29,r29,-0x0018     |
00197e6c: afb00010 sw r16,0x0010(r29)        |
00197e70: 3c10801a lui r16,0x801a            |
00197e74: 2610f3c4 addiu r16,r16,0xf3c4      |0x8019f3c4
00197e78: 14400013 bne r2,r0,0x00197ec8      #If AI 0x19b7 <> 0x00 : branch directly to   Simulation  (Ability is chosen or return where the routine fails ?)
00197e7c: afbf0014 sw r31,0x0014(r29)        |
                                             Else : AI 0x19b7 = 0x00
00197e80: 3c01801a lui r1,0x801a                 |
00197e84: a0200081 sb r0,0x0081(r1)              |Initialize Ability counter (at 0x801a0081) AI 0x0cbd
                                                @LOOP - Each Ability
00197e88: 92030e2f lbu r3,0x0e2f(r16)                |Load acting unit ID
00197e8c: 00000000 nop                               |
00197e90: 00031100 sll r2,r3,0x04                    |
00197e94: 00431021 addu r2,r2,r3                     |
00197e98: 000210c0 sll r2,r2,0x03                    |ID *0x88
00197e9c: 24420ef0 addiu r2,r2,0x0ef0                |
00197ea0: 92030cbd lbu r3,0x0cbd(r16)                |Load Ability counter
00197ea4: 02021021 addu r2,r16,r2                    |0x8019f3c4 + 0x0ef0 + Unit offset This unit start of usable abilities list
00197ea8: 00031880 sll r3,r3,0x02                    |Ability offset (1 word per ability)
00197eac: 00432021 addu r4,r2,r3                     |This Ability pointer 0x8019f3c4 + 0x0ef0 + Unit offset + Ability offset
00197eb0: 90830002 lbu r3,0x0002(r4)                 |Load This Ability skillset
00197eb4: 340200ff ori r2,r0,0x00ff                  |
00197eb8: 10620011 beq r3,r2,0x00197f00              #If End of usable Abilities  Exit routine Returns 0x00
00197ebc: 00001021 addu r2,r0,r0                     |
00197ec0: 0c06561e jal 0x00195878                    |-->AI_Ability_Data_Setting Set  data  at 8019f3c4 (from 0x00 to 0x13)
00197ec4: 00000000 nop                               |
                  AI 0x19b7 <>0
00197ec8: 0c066bc6 jal 0x0019af18                    |-->AI_Ability_Outcome_Evaluation Test All destination and targetable tile with this ability (save results in AI 0x54 Tables)
00197ecc: 00000000 nop                               |
00197ed0: 2403ffff addiu r3,r0,-0x0001               |
00197ed4: 1043000a beq r2,r3,0x00197f00              #If returned value is -0x01 Exit routine Returns -0x01
00197ed8: 2402ffff addiu r2,r0,-0x0001               |
00197edc: 92020cbd lbu r2,0x0cbd(r16)                |Load Current ability counter
00197ee0: 00000000 nop                               |
00197ee4: 24420001 addiu r2,r2,0x0001                |
00197ee8: a2020cbd sb r2,0x0cbd(r16)                 |Increase Ability counter by 0x1
00197eec: 92020cbd lbu r2,0x0cbd(r16)                |Load Current ability counter
00197ef0: 00000000 nop                               |
00197ef4: 2c420022 sltiu r2,r2,0x0022                |Check List limit
00197ef8: 1440ffe3 bne r2,r0,0x00197e88          #Do for all moves
00197efc: 00001021 addu r2,r0,r0                 |returns 0x00
00197f00: 8fbf0014 lw r31,0x0014(r29)
00197f04: 8fb00010 lw r16,0x0010(r29)
00197f08: 27bd0018 addiu r29,r29,0x0018
00197f0c: 03e00008 jr r31
00197f10: 00000000 nop

Return locations

BATTLE.BIN
 00196258: Non-Specific_AI_AutoBattle_(Enemies)
 00198248: Fight_for_Life_-_Auto_Battle_(00197ff4)
 00198288: Fight_for_Life_-_Auto_Battle_(00197ff4)
 00198750: Protect_Allies_-_Auto_Battle_(001984ec)
 00198790: Protect_Allies_-_Auto_Battle_(001984ec)
 001987c8: Protect_Allies_-_Auto_Battle_(001984ec)
 00198f28: AI_Critical_or_Run_Like_Rabbit
 00199000: AI_Critical_or_Run_Like_Rabbit