Difference between revisions of "Math Skill ability loading"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
Line 1: Line 1:
 
  00182068: 27bdff20 addiu r29,r29,0xff20
 
  00182068: 27bdff20 addiu r29,r29,0xff20
 
  0018206c: afb300cc sw r19,0x00cc(r29)
 
  0018206c: afb300cc sw r19,0x00cc(r29)
  00182070: 00809821 addu r19,r4,r0
+
  00182070: 00809821 addu r19,r4,r0 r19 = Unit ID
 
  00182074: afb000c0 sw r16,0x00c0(r29)
 
  00182074: afb000c0 sw r16,0x00c0(r29)
  00182078: 00c08021 addu r16,r6,r0
+
  00182078: 00c08021 addu r16,r6,r0 r16 = Some Stack Pointer
 
  0018207c: afb200c8 sw r18,0x00c8(r29)
 
  0018207c: afb200c8 sw r18,0x00c8(r29)
  00182080: 00009021 addu r18,r0,r0
+
  00182080: 00009021 addu r18,r0,r0 Clear r18
 
  00182084: afbf00d8 sw r31,0x00d8(r29)
 
  00182084: afbf00d8 sw r31,0x00d8(r29)
 
  00182088: afb500d4 sw r21,0x00d4(r29)
 
  00182088: afb500d4 sw r21,0x00d4(r29)
Line 19: Line 19:
 
  001820b0: 02602021 addu r4,r19,r0
 
  001820b0: 02602021 addu r4,r19,r0
 
  001820b4: 0c060435 jal 0x001810d4 load unit data
 
  001820b4: 0c060435 jal 0x001810d4 load unit data
  001820b8: 00a08821 addu r17,r5,r0
+
  001820b8: 00a08821 addu r17,r5,r0 r17 = Skillset ID
 
  001820bc: 14400003 bne r2,r0,0x 001820cc branch if unit found
 
  001820bc: 14400003 bne r2,r0,0x 001820cc branch if unit found
  001820c0: 322300ff andi r3,r17,0x00ff
+
  001820c0: 322300ff andi r3,r17,0x00ff
  001820c4: 08060869 j 0x 001821a4
+
  001820c4: 08060869 j 0x001821a4
 
  001820c8: 00001021 addu r2,r0,r0
 
  001820c8: 00001021 addu r2,r0,r0
 
 
  001820cc: 34020015 ori r2,r0,0x0015
 
  001820cc: 34020015 ori r2,r0,0x0015
 
  001820d0: 10620004 beq r3,r2,0x 001820e4 branch if skillset = math skill
 
  001820d0: 10620004 beq r3,r2,0x 001820e4 branch if skillset = math skill
Line 31: Line 30:
 
  001820dc: 08060869 j 0x 001821a4
 
  001820dc: 08060869 j 0x 001821a4
 
  001820e0: 00001021 addu r2,r0,r0
 
  001820e0: 00001021 addu r2,r0,r0
 
+
  001820e4: 00008821 addu r17,r0,r0 Clear Counter
  001820e4: 00008821 addu r17,r0,r0
+
  001820e8: 27b50020 addiu r21,r29,0x0020 r21 = Stack Offset + x20
  001820e8: 27b50020 addiu r21,r29,0x0020
 
 
  001820ec: 3c148006 lui r20,0x8006
 
  001820ec: 3c148006 lui r20,0x8006
  001820f0: 2694fbf0 addiu r20,r20,0xfbf0 load ability data
+
  001820f0: 2694fbf0 addiu r20,r20,0xfbf0 r20 = Ability Data Offset
 
  001820f4: 02602021 addu r4,r19,r0
 
  001820f4: 02602021 addu r4,r19,r0
  001820f8: 03b11021 addu r2,r29,r17
+
  001820f8: 03b11021 addu r2,r29,r17 r2 = Stack Offset + Counter
  001820fc: 904500a8 lbu r5,0x00a8(r2)
+
  001820fc: 904500a8 lbu r5,0x00a8(r2)
  00182100: 27a20060 addiu r2,r29,0x0060
+
  00182100: 27a20060 addiu r2,r29,0x0060
 
  00182104: afa20010 sw r2,0x0010(r29)
 
  00182104: afa20010 sw r2,0x0010(r29)
 
  00182108: 34020001 ori r2,r0,0x0001
 
  00182108: 34020001 ori r2,r0,0x0001
Line 58: Line 56:
 
  00182144: 84a20000 lh r2,0x0000(r5)                              load ability ID?
 
  00182144: 84a20000 lh r2,0x0000(r5)                              load ability ID?
 
  00182148: 00000000 nop
 
  00182148: 00000000 nop
  0018214c: 000218c0 sll r3,r2,0x03
+
  0018214c: 000218c0 sll r3,r2,0x03 Ability ID * 8
  00182150: 00621823 subu r3,r3,r2
+
  00182150: 00621823 subu r3,r3,r2 Ability ID * 7
  00182154: 00031840 sll r3,r3,0x01
+
  00182154: 00031840 sll r3,r3,0x01 Ability ID * 14
  00182158: 00741821 addu r3,r3,r20
+
  00182158: 00741821 addu r3,r3,r20 Pointer to Ability Data
  0018215c: 90630005 lbu r3,0x0005(r3)                           load flags
+
  0018215c: 90630005 lbu r3,0x0005(r3)                           Load Ability Flags
 
  00182160: 00000000 nop
 
  00182160: 00000000 nop
 
  00182164: 30630040 andi r3,r3,0x0040
 
  00182164: 30630040 andi r3,r3,0x0040
  00182168: 10600004 beq r3,r0,0x 0018217c                       branch if not math skill
+
  00182168: 10600004 beq r3,r0,0x 0018217c                       Branch if Math Skill is not flagged
  0018216c: 24a50002 addiu r5,r5,0x0002
+
  0018216c: 24a50002 addiu r5,r5,0x0002 r5 + 2
  00182170: a6020000 sh r2,0x0000(r16)
+
  00182170: a6020000 sh r2,0x0000(r16) Store Ability ID into Stack
  00182174: 26100002 addiu r16,r16,0x0002
+
  00182174: 26100002 addiu r16,r16,0x0002 Stack Pointer + 2
  00182178: 26520001 addiu r18,r18,0x0001
+
  00182178: 26520001 addiu r18,r18,0x0001 r18 ++ (2nd Counter)
  0018217c: 24840001 addiu r4,r4,0x0001
+
  0018217c: 24840001 addiu r4,r4,0x0001 r4 ++
 
  00182180: 0086102a slt r2,r4,r6
 
  00182180: 0086102a slt r2,r4,r6
 
  00182184: 1440ffef bne r2,r0,0x 00182144
 
  00182184: 1440ffef bne r2,r0,0x 00182144
 
  00182188: 00000000 nop
 
  00182188: 00000000 nop
  0018218c: 26310001 addiu r17,r17,0x0001
+
  0018218c: 26310001 addiu r17,r17,0x0001 Counter ++
  00182190: 2a220004 slti r2,r17,0x0004                     do for first 5 sets of abilities
+
  00182190: 2a220004 slti r2,r17,0x0004
  00182194: 1440ffd7 bne r2,r0,0x 001820f4
+
  00182194: 1440ffd7 bne r2,r0,0x 001820f4 Loop 5 times
 
  00182198: 2402ffff addiu r2,r0,0xffff
 
  00182198: 2402ffff addiu r2,r0,0xffff
  0018219c: a6020000 sh r2,0x0000(r16)
+
  0018219c: a6020000 sh r2,0x0000(r16) Mark end of stored Skillsets
  001821a0: 02401021 addu r2,r18,r0
+
  001821a0: 02401021 addu r2,r18,r0 r2 = Amount of Stored Abilities
 
  001821a4: 8fbf00d8 lw r31,0x00d8(r29)
 
  001821a4: 8fbf00d8 lw r31,0x00d8(r29)
 
  001821a8: 8fb500d4 lw r21,0x00d4(r29)
 
  001821a8: 8fb500d4 lw r21,0x00d4(r29)

Revision as of 17:12, 5 August 2017

00182068: 27bdff20 addiu r29,r29,0xff20
0018206c: afb300cc sw r19,0x00cc(r29)
00182070: 00809821 addu r19,r4,r0				r19 = Unit ID
00182074: afb000c0 sw r16,0x00c0(r29)
00182078: 00c08021 addu r16,r6,r0				r16 = Some Stack Pointer
0018207c: afb200c8 sw r18,0x00c8(r29)
00182080: 00009021 addu r18,r0,r0				Clear r18
00182084: afbf00d8 sw r31,0x00d8(r29)
00182088: afb500d4 sw r21,0x00d4(r29)
0018208c: afb400d0 sw r20,0x00d0(r29)
00182090: afb100c4 sw r17,0x00c4(r29)
00182094: 3c068017 lui r6,0x8017
00182098: 24c64170 addiu r6,r6,0x4170			??
0018209c: 88c20003 lwl r2,0x0003(r6)
001820a0: 98c20000 lwr r2,0x0000(r6)
001820a4: 00000000 nop
001820a8: aba200ab swl r2,0x00ab(r29)
001820ac: bba200a8 swr r2,0x00a8(r29)
001820b0: 02602021 addu r4,r19,r0
001820b4: 0c060435 jal 0x001810d4				load unit data
001820b8: 00a08821 addu r17,r5,r0				r17 = Skillset ID
001820bc: 14400003 bne r2,r0,0x 001820cc			branch if unit found
001820c0: 322300ff andi r3,r17,0x00ff				
001820c4: 08060869 j 0x001821a4				
001820c8: 00001021 addu r2,r0,r0
001820cc: 34020015 ori r2,r0,0x0015
001820d0: 10620004 beq r3,r2,0x 001820e4			branch if skillset = math skill
001820d4: 2402ffff addiu r2,r0,0xffff
001820d8: a6020000 sh r2,0x0000(r16)
001820dc: 08060869 j 0x 001821a4
001820e0: 00001021 addu r2,r0,r0
001820e4: 00008821 addu r17,r0,r0				Clear Counter
001820e8: 27b50020 addiu r21,r29,0x0020			r21 = Stack Offset + x20
001820ec: 3c148006 lui r20,0x8006
001820f0: 2694fbf0 addiu r20,r20,0xfbf0			r20 = Ability Data Offset
001820f4: 02602021 addu r4,r19,r0
001820f8: 03b11021 addu r2,r29,r17				r2 = Stack Offset + Counter
001820fc: 904500a8 lbu r5,0x00a8(r2)				
00182100: 27a20060 addiu r2,r29,0x0060		
00182104: afa20010 sw r2,0x0010(r29)
00182108: 34020001 ori r2,r0,0x0001
0018210c: afa20014 sw r2,0x0014(r29)
00182110: 27a20078 addiu r2,r29,0x0078
00182114: afa20018 sw r2,0x0018(r29)
00182118: 27a20090 addiu r2,r29,0x0090
0018211c: 27a60020 addiu r6,r29,0x0020
00182120: 27a70048 addiu r7,r29,0x0048
00182124: 0c0605f0 jal 0x001817c0				load abilities from skillset
00182128: afa2001c sw r2,0x001c(r29)
0018212c: 00403021 addu r6,r2,r0
00182130: 10c00016 beq r6,r0,0x 0018218c                        branch if fail
00182134: 00000000 nop
00182138: 18c00014 blez r6,0x 0018218c                           branch if fail
0018213c: 00002021 addu r4,r0,r0
00182140: 02a02821 addu r5,r21,r0
00182144: 84a20000 lh r2,0x0000(r5)                              load ability ID?
00182148: 00000000 nop
0018214c: 000218c0 sll r3,r2,0x03				Ability ID * 8
00182150: 00621823 subu r3,r3,r2				Ability ID * 7
00182154: 00031840 sll r3,r3,0x01				Ability ID * 14
00182158: 00741821 addu r3,r3,r20				Pointer to Ability Data
0018215c: 90630005 lbu r3,0x0005(r3)                           Load Ability Flags
00182160: 00000000 nop
00182164: 30630040 andi r3,r3,0x0040
00182168: 10600004 beq r3,r0,0x 0018217c                       Branch if Math Skill is not flagged
0018216c: 24a50002 addiu r5,r5,0x0002				r5 + 2
00182170: a6020000 sh r2,0x0000(r16)				Store Ability ID into Stack
00182174: 26100002 addiu r16,r16,0x0002			Stack Pointer + 2
00182178: 26520001 addiu r18,r18,0x0001			r18 ++ (2nd Counter)
0018217c: 24840001 addiu r4,r4,0x0001				r4 ++ 
00182180: 0086102a slt r2,r4,r6
00182184: 1440ffef bne r2,r0,0x 00182144
00182188: 00000000 nop
0018218c: 26310001 addiu r17,r17,0x0001			Counter ++
00182190: 2a220004 slti r2,r17,0x0004				
00182194: 1440ffd7 bne r2,r0,0x 001820f4			Loop 5 times
00182198: 2402ffff addiu r2,r0,0xffff
0018219c: a6020000 sh r2,0x0000(r16)				Mark end of stored Skillsets
001821a0: 02401021 addu r2,r18,r0				r2 = Amount of Stored Abilities
001821a4: 8fbf00d8 lw r31,0x00d8(r29)
001821a8: 8fb500d4 lw r21,0x00d4(r29)
001821ac: 8fb400d0 lw r20,0x00d0(r29)
001821b0: 8fb300cc lw r19,0x00cc(r29)
001821b4: 8fb200c8 lw r18,0x00c8(r29)
001821b8: 8fb100c4 lw r17,0x00c4(r29)
001821bc: 8fb000c0 lw r16,0x00c0(r29)
001821c0: 27bd00e0 addiu r29,r29,0x00e0
001821c4: 03e00008 jr r31
001821c8: 00000000 nop