Difference between revisions of "Store Skillset's Abilities"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
(Created page with " Store Skillset's Abilities 0005a638: 27bdffd8 addiu r29,r29,0xffd8 0005a63c: afb40020 sw r20,0x0020(r29) 0005a640: 0080a021 addu r20,r4,r0 r20 = Unit's Skillset 0005a644...")
 
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
  Store Skillset's Abilities
+
  [[Routine_Locations#SCUS_942.21_RAM|SCUS_942.21]] : Store Skillset's Abilities
  0005a638: 27bdffd8 addiu r29,r29,0xffd8
+
---------------------------------------------------------------------
  0005a63c: afb40020 sw r20,0x0020(r29)
+
Parameters : r4 - Unit's Skillset ID
  0005a640: 0080a021 addu r20,r4,r0 r20 = Unit's Skillset
+
              r5 - Type of Ability to check : 0x01 - Action
  0005a644: afb20018 sw r18,0x0018(r29)
+
                                                0x02 - Reaction
  0005a648: 00a09021 addu r18,r5,r0 r18 = Check
+
                                                0x04 - Movement
  0005a64c: 2a820100 slti r2,r20,0x0100
+
                                                0x08 - Support
  0005a650: afbf0024 sw r31,0x0024(r29)
+
                                               
  0005a654: afb3001c sw r19,0x001c(r29)
+
Returns : r2 = 0x80066204 (Temporary Ability list pointer)
  0005a658: afb10014 sw r17,0x0014(r29)
+
------------------------------------------------------------------------
  0005a65c: 14400002 bne r2,r0,0x0005a668 Branch if Skillset is valid
+
  0005a638: 27bdffd8 addiu r29,r29,-0x0028    |
  0005a660: afb00010 sw r16,0x0010(r29)
+
  0005a63c: afb40020 sw r20,0x0020(r29)       |
  0005a664: 0000a021 addu r20,r0,r0 Skillset = 0
+
  0005a640: 0080a021 addu r20,r4,r0           |{{f/std|<nowiki>r20 = Unit's Skillset</nowiki>}}
  0005a668: 00008021 addu r16,r0,r0 Counter = 0 (useless)
+
  0005a644: afb20018 sw r18,0x0018(r29)       |
  0005a66c: 00008821 addu r17,r0,r0 Counter2 = 0
+
  0005a648: 00a09021 addu r18,r5,r0           |{{f/std|<nowiki>r18 = Check</nowiki>}}
  0005a670: 3c138006 lui r19,0x8006
+
  0005a64c: 2a820100 slti r2,r20,0x0100       |{{f/std|Check if skillset ID <0x100 (?? Last monster skillset is DF)}}
  0005a674: 26736204 addiu r19,r19,0x6204 r19 = Pointer to Temp Ability List
+
  0005a650: afbf0024 sw r31,0x0024(r29)       |
  0005a678: 02802021 addu r4,r20,r0 r4 = Skillset
+
  0005a654: afb3001c sw r19,0x001c(r29)       |
  0005a67c: 0c01695a jal 0x0005a568 Load Ability From Skillset
+
  0005a658: afb10014 sw r17,0x0014(r29)       |
  0005a680: 02202821 addu r5,r17,r0 r5 = Counter2
+
  0005a65c: 14400002 bne r2,r0,0x0005a668     {{f/Cond|If Skillset ID is not a byte (invalid)}}
  0005a684: 00402021 addu r4,r2,r0 r4 = Ability ID
+
  0005a660: afb00010 sw r16,0x0010(r29)           |
  0005a688: 3083ffff andi r3,r4,0xffff r3 = Ability ID
+
  0005a664: 0000a021 addu r20,r0,r0               |{{f/std|Nullify skillset ID}}
  0005a68c: 2c6201a6 sltiu r2,r3,0x01a6 (pretty useless series of checks)
+
  0005a668: 00008021 addu r16,r0,r0           |{{f/std|<nowiki>Counter = 0 (useless)</nowiki>}}
  0005a690: 14400008 bne r2,r0,0x0005a6b4 Branch if Ability is an Ability
+
  0005a66c: 00008821 addu r17,r0,r0           |{{f/std|Ability counter}}
  0005a694: 32420001 andi r2,r18,0x0001 Check = Ability
+
  0005a670: 3c138006 lui r19,0x8006           |
  0005a698: 2c6201c6 sltiu r2,r3,0x01c6
+
  0005a674: 26736204 addiu r19,r19,0x6204     |{{f/adr|<nowiki>r19 = Pointer to Temp Ability List</nowiki>}}
  0005a69c: 14400005 bne r2,r0,0x0005a6b4 Branch if Ability is a Reaction
+
                                            {{f/bloop|LOOP 0x18 times - check all skillset abilities}} (and more !?)
  0005a6a0: 32420002 andi r2,r18,0x0002 Check = Reaction
+
  0005a678: 02802021 addu r4,r20,r0               |{{f/std|<nowiki>r4 = Skillset ID</nowiki>}}
  0005a6a4: 2c6201e7 sltiu r2,r3,0x01e7 (should be 0x1e6, but doesn't matter anyway)
+
  0005a67c: 0c01695a jal 0x0005a568               |{{f/jal|Load Ability From Skillset|Load Ability From Skillset}} {{f/std|<nowiki>returns r2 = Skillset N°r5 Ability ID</nowiki>}}
  0005a6a8: 14400002 bne r2,r0,0x0005a6b4 Branch if Ability is a Support
+
  0005a680: 02202821 addu r5,r17,r0               |{{f/std|<nowiki>r5 = Counter2</nowiki>}}
  0005a6ac: 32420008 andi r2,r18,0x0008 Check = Support
+
  0005a684: 00402021 addu r4,r2,r0               |{{f/std|<nowiki>r4 = Ability ID</nowiki>}}
  0005a6b0: 32420004 andi r2,r18,0x0004 Check = Movement  
+
  0005a688: 3083ffff andi r3,r4,0xffff           |{{f/std|<nowiki>r3 = Ability ID</nowiki>}}
  0005a6b4: 14400002 bne r2,r0,0x0005a6c0 Branch if Check != 0 (Can't get here with r2 = 0)
+
  0005a68c: 2c6201a6 sltiu r2,r3,0x01a6           |{{f/std|check if Ability ID is a action Ability}}
  0005a6b8: 26100001 addiu r16,r16,0x0001 Counter ++ (Counter and Counter2 are always the same)
+
  0005a690: 14400008 bne r2,r0,0x0005a6b4         {{f/Cond|If Ability ID is not an action}}
  0005a6bc: 00002021 addu r4,r0,r0 Ability ID = 0
+
  0005a694: 32420001 andi r2,r18,0x0001           |{{f/std|<nowiki>Check = Ability</nowiki>}}
  0005a6c0: a6640000 sh r4,0x0000(r19) Store Ability ID
+
  0005a698: 2c6201c6 sltiu r2,r3,0x01c6               |{{f/std|Check if Ability is a reaction}}
  0005a6c4: 26310001 addiu r17,r17,0x0001 Counter2 ++
+
  0005a69c: 14400005 bne r2,r0,0x0005a6b4             {{f/Cond|If Ability is not a reaction}}
  0005a6c8: 2a220018 slti r2,r17,0x0018 (Load Ability function stops at 0x16 :/)
+
  0005a6a0: 32420002 andi r2,r18,0x0002               |{{f/std|<nowiki>Check = Reaction</nowiki>}}
  0005a6cc: 1440ffea bne r2,r0,0x0005a678 Branch if Counter2 < 0x18
+
  0005a6a4: 2c6201e7 sltiu r2,r3,0x01e7                   |{{f/std|check if ability is a support}} {{f/std| Bug : should check 0x1e6}}
  0005a6d0: 26730002 addiu r19,r19,0x0002 Temp Ability List Pointer += 2
+
  0005a6a8: 14400002 bne r2,r0,0x0005a6b4                 {{f/Cond|Branch if Ability is a Support}}
  0005a6d4: 2a020018 slti r2,r16,0x0018
+
  0005a6ac: 32420008 andi r2,r18,0x0008                   |{{f/std|<nowiki>Check = Support</nowiki>}}
  0005a6d8: 10400009 beq r2,r0,0x0005a700 Branch if Counter >= 0x18 (guaranteed)
+
  0005a6b0: 32420004 andi r2,r18,0x0004                   |{{f/std|<nowiki>Check = Movement </nowiki>}}
  0005a6dc: 00101040 sll r2,r16,0x01 Counter * 2
+
  0005a6b4: 14400002 bne r2,r0,0x0005a6c0         {{f/Cond|<nowiki>If r2 = 0x00 (Ability ID and check value do not match)</nowiki>}}
  0005a6e0: 3c038006 lui r3,0x8006
+
  0005a6b8: 26100001 addiu r16,r16,0x0001         |{{f/std|Counter 2 +1}}
  0005a6e4: 24636204 addiu r3,r3,0x6204 (think this was just to null the last
+
  0005a6bc: 00002021 addu r4,r0,r0                   |{{f/std|<nowiki>Ability ID = 0</nowiki>}}
  0005a6e8: 00431821 addu r3,r2,r3 abilities, but isn't needed anyway)
+
  0005a6c0: a6640000 sh r4,0x0000(r19)           |{{f/store|Store Ability ID in 0x80066204 table}}
  0005a6ec: a4600000 sh r0,0x0000(r3) Store Ability ID = 0
+
  0005a6c4: 26310001 addiu r17,r17,0x0001         |{{f/std|Ability counter +1}}
  0005a6f0: 26100001 addiu r16,r16,0x0001 Counter * 2
+
  0005a6c8: 2a220018 slti r2,r17,0x0018           |{{f/std|Check if ability counter < 0x18}} {{f/std|Note that any value above 0x15 will be ignored in Load Ability From Skillset}}
  0005a6f4: 2a020018 slti r2,r16,0x0018
+
  0005a6cc: 1440ffea bne r2,r0,0x0005a678     {{f/eloop|Loop while counter < 0x18}}
  0005a6f8: 1440fffc bne r2,r0,0x0005a6ec Branch if Counter < 0x18
+
  0005a6d0: 26730002 addiu r19,r19,0x0002         |{{f/adr|<nowiki>Temp Ability List Pointer += 2</nowiki>}}
  0005a6fc: 24630002 addiu r3,r3,0x0002 Temp Ability List Pointer += 2
+
  0005a6d4: 2a020018 slti r2,r16,0x0018       |{{f/std|Check if counter2 goes until 0x18}}
  0005a700: 3c028006 lui r2,0x8006
+
  0005a6d8: 10400009 beq r2,r0,0x0005a700     {{f/Cond|If counter2 < 0x18 (never ?)}}
  0005a704: 24426204 addiu r2,r2,0x6204 r2 = Temp Ability List Pointer
+
  0005a6dc: 00101040 sll r2,r16,0x01             |{{f/std|Counter * 2}}
 +
  0005a6e0: 3c038006 lui r3,0x8006               |
 +
  0005a6e4: 24636204 addiu r3,r3,0x6204           |{{f/adr|Temp Ability list pointer}}
 +
  0005a6e8: 00431821 addu r3,r2,r3               |{{f/std|Ability List + counter offset}}
 +
                                                {{f/loop|LOOP until end of list (until 0x18 abilities ?!)
 +
  0005a6ec: a4600000 sh r0,0x0000(r3)                 |{{f/store|<nowiki>Store Ability ID = 0</nowiki>}}
 +
  0005a6f0: 26100001 addiu r16,r16,0x0001             |{{f/std|Counter2 +1}}
 +
  0005a6f4: 2a020018 slti r2,r16,0x0018               |{{f/std|check if counter < 0x18}}
 +
  0005a6f8: 1440fffc bne r2,r0,0x0005a6ec         {{f/eloop|Loop while Counter < 0x18}}
 +
  0005a6fc: 24630002 addiu r3,r3,0x0002               |{{f/adr|<nowiki>Temp Ability List Pointer offset += 2</nowiki>}}
 +
  0005a700: 3c028006 lui r2,0x8006           |{{f/std|}}
 +
  0005a704: 24426204 addiu r2,r2,0x6204       |{{f/std|<nowiki>r2 = Returns Temp Ability List Pointer</nowiki>}}
 
  0005a708: 8fbf0024 lw r31,0x0024(r29)
 
  0005a708: 8fbf0024 lw r31,0x0024(r29)
 
  0005a70c: 8fb40020 lw r20,0x0020(r29)
 
  0005a70c: 8fb40020 lw r20,0x0020(r29)
Line 61: Line 72:
 
  0005a724: 03e00008 jr r31
 
  0005a724: 03e00008 jr r31
 
  0005a728: 00000000 nop
 
  0005a728: 00000000 nop
 +
=== Return location ===
 +
'''WORLD.BIN'''
 +
0012562c: [[001255e4_-_001256c4]] r5 = 0x0f
 +
001229b0: [[Skillset_Display]] r5 = 0x0f
 +
00120e34: [[Load_party_data_into_Formation_screen_data]] r5 = 0x01
 +
 +
'''BATTLE.BIN'''
 +
00133a14: [[Store units small in battle display data]] r5 = 0x01
 +
001975e0: [[Store ability/skillset data, set AI settings for ability?]] r5 = 0x01
 +
0019a680: [[Usable Ability Setting]] r5 = 0x01
 +
0019bc70: [[Math_Skill_Targeting]] r5 = 0x01
 +
 +
'''ATTACK.OUT'''
 +
001c5f9c: [[001c5be0_-_001c60dc]] r5 = 0x01
 +
 +
'''REQUIRE.OUT'''
 +
001c5c8c: [[001c58d0_-_001c5dcc]] r5 = 0x01
 +
 +
'''DEBUGCHR.OUT'''
 +
001c2db0: [[DEBUGCHR.OUT/001c2af0_-_001c3030]] r5 = 0x01
 +
 +
'''Not sure'''
 +
001c2b40: [[001c2888_-_001c2dc8]] r5 = 0x01
 +
000875b8: [[00087254_-_00087654]] r5 = 0x01
 +
000e808c: [[000e7dcc_-_000e830c]] r5 = 0x01 (Probably world.bin)

Latest revision as of 20:36, 20 April 2023

SCUS_942.21 : Store Skillset's Abilities
---------------------------------------------------------------------
Parameters : r4 - Unit's Skillset ID
             r5 - Type of Ability to check : 0x01 - Action
                                               0x02 - Reaction
                                               0x04 - Movement
                                               0x08 - Support
                                                
Returns : r2 = 0x80066204 (Temporary Ability list pointer)
------------------------------------------------------------------------
0005a638: 27bdffd8 addiu r29,r29,-0x0028    |
0005a63c: afb40020 sw r20,0x0020(r29)       |
0005a640: 0080a021 addu r20,r4,r0           |r20 = Unit's Skillset
0005a644: afb20018 sw r18,0x0018(r29)       |
0005a648: 00a09021 addu r18,r5,r0           |r18 = Check
0005a64c: 2a820100 slti r2,r20,0x0100       |Check if skillset ID <0x100 (?? Last monster skillset is DF)
0005a650: afbf0024 sw r31,0x0024(r29)       |
0005a654: afb3001c sw r19,0x001c(r29)       |
0005a658: afb10014 sw r17,0x0014(r29)       |
0005a65c: 14400002 bne r2,r0,0x0005a668     #If Skillset ID is not a byte (invalid)
0005a660: afb00010 sw r16,0x0010(r29)           |
0005a664: 0000a021 addu r20,r0,r0               |Nullify skillset ID
0005a668: 00008021 addu r16,r0,r0           |Counter = 0 (useless)
0005a66c: 00008821 addu r17,r0,r0           |Ability counter
0005a670: 3c138006 lui r19,0x8006           |
0005a674: 26736204 addiu r19,r19,0x6204     |r19 = Pointer to Temp Ability List
                                            @LOOP 0x18 times - check all skillset abilities (and more !?)
0005a678: 02802021 addu r4,r20,r0               |r4 = Skillset ID
0005a67c: 0c01695a jal 0x0005a568               |-->Load Ability From Skillset returns r2 = Skillset N°r5 Ability ID
0005a680: 02202821 addu r5,r17,r0               |r5 = Counter2
0005a684: 00402021 addu r4,r2,r0                |r4 = Ability ID
0005a688: 3083ffff andi r3,r4,0xffff            |r3 = Ability ID
0005a68c: 2c6201a6 sltiu r2,r3,0x01a6           |check if Ability ID is a action Ability
0005a690: 14400008 bne r2,r0,0x0005a6b4         #If Ability ID is not an action
0005a694: 32420001 andi r2,r18,0x0001           |Check = Ability
0005a698: 2c6201c6 sltiu r2,r3,0x01c6               |Check if Ability is a reaction
0005a69c: 14400005 bne r2,r0,0x0005a6b4             #If Ability is not a reaction
0005a6a0: 32420002 andi r2,r18,0x0002               |Check = Reaction
0005a6a4: 2c6201e7 sltiu r2,r3,0x01e7                   |check if ability is a support  Bug : should check 0x1e6
0005a6a8: 14400002 bne r2,r0,0x0005a6b4                 #Branch if Ability is a Support
0005a6ac: 32420008 andi r2,r18,0x0008                   |Check = Support
0005a6b0: 32420004 andi r2,r18,0x0004                   |Check = Movement 
0005a6b4: 14400002 bne r2,r0,0x0005a6c0         #If r2 = 0x00 (Ability ID and check value do not match)
0005a6b8: 26100001 addiu r16,r16,0x0001         |Counter 2 +1
0005a6bc: 00002021 addu r4,r0,r0                    |Ability ID = 0
0005a6c0: a6640000 sh r4,0x0000(r19)            |Store Ability ID in 0x80066204 table
0005a6c4: 26310001 addiu r17,r17,0x0001         |Ability counter +1
0005a6c8: 2a220018 slti r2,r17,0x0018           |Check if ability counter < 0x18 Note that any value above 0x15 will be ignored in Load Ability From Skillset
0005a6cc: 1440ffea bne r2,r0,0x0005a678     Λ Loop while counter < 0x18
0005a6d0: 26730002 addiu r19,r19,0x0002         |Temp Ability List Pointer += 2
0005a6d4: 2a020018 slti r2,r16,0x0018       |Check if counter2 goes until 0x18
0005a6d8: 10400009 beq r2,r0,0x0005a700     #If counter2 < 0x18 (never ?)
0005a6dc: 00101040 sll r2,r16,0x01              |Counter * 2
0005a6e0: 3c038006 lui r3,0x8006                |
0005a6e4: 24636204 addiu r3,r3,0x6204           |Temp Ability list pointer
0005a6e8: 00431821 addu r3,r2,r3                |Ability List + counter offset
                                                {{f/loop|LOOP until end of list (until 0x18 abilities ?!)
0005a6ec: a4600000 sh r0,0x0000(r3)                 |Store Ability ID = 0
0005a6f0: 26100001 addiu r16,r16,0x0001             |Counter2 +1
0005a6f4: 2a020018 slti r2,r16,0x0018               |check if counter < 0x18
0005a6f8: 1440fffc bne r2,r0,0x0005a6ec         Λ Loop while Counter < 0x18
0005a6fc: 24630002 addiu r3,r3,0x0002               |Temp Ability List Pointer offset += 2
0005a700: 3c028006 lui r2,0x8006            |
0005a704: 24426204 addiu r2,r2,0x6204       |r2 = Returns Temp Ability List Pointer
0005a708: 8fbf0024 lw r31,0x0024(r29)
0005a70c: 8fb40020 lw r20,0x0020(r29)
0005a710: 8fb3001c lw r19,0x001c(r29)
0005a714: 8fb20018 lw r18,0x0018(r29)
0005a718: 8fb10014 lw r17,0x0014(r29)
0005a71c: 8fb00010 lw r16,0x0010(r29)
0005a720: 27bd0028 addiu r29,r29,0x0028
0005a724: 03e00008 jr r31
0005a728: 00000000 nop

Return location

WORLD.BIN
0012562c: 001255e4_-_001256c4 r5 = 0x0f
001229b0: Skillset_Display r5 = 0x0f
00120e34: Load_party_data_into_Formation_screen_data r5 = 0x01

BATTLE.BIN
00133a14: Store units small in battle display data r5 = 0x01
001975e0: Store ability/skillset data, set AI settings for ability? r5 = 0x01
0019a680: Usable Ability Setting r5 = 0x01
0019bc70: Math_Skill_Targeting r5 = 0x01

ATTACK.OUT
001c5f9c: 001c5be0_-_001c60dc r5 = 0x01

REQUIRE.OUT
001c5c8c: 001c58d0_-_001c5dcc r5 = 0x01

DEBUGCHR.OUT
001c2db0: DEBUGCHR.OUT/001c2af0_-_001c3030 r5 = 0x01

Not sure
001c2b40: 001c2888_-_001c2dc8 r5 = 0x01
000875b8: 00087254_-_00087654 r5 = 0x01
000e808c: 000e7dcc_-_000e830c r5 = 0x01 (Probably world.bin)