Difference between revisions of "Learn on hit 2"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
(Created page with "<font face='Courier New'> 0018e8ac: 27bdffd0 addiu r29,r29,0xffd0 0018e8b0: afbf002c sw r31,0x002c(r29) 0018e8b4: afb40028 sw r20,0x0028(r29) 0018e8b8: afb30024 sw r19,0...")
 
 
Line 1: Line 1:
<font face='Courier New'>
+
Parameters:
+
    #r4 = Unit data pointer?
 +
 
 
  0018e8ac: 27bdffd0 addiu r29,r29,0xffd0
 
  0018e8ac: 27bdffd0 addiu r29,r29,0xffd0
 
  0018e8b0: afbf002c sw r31,0x002c(r29)
 
  0018e8b0: afbf002c sw r31,0x002c(r29)
Line 8: Line 9:
 
  0018e8c0: afb1001c sw r17,0x001c(r29)
 
  0018e8c0: afb1001c sw r17,0x001c(r29)
 
  0018e8c4: afb00018 sw r16,0x0018(r29)
 
  0018e8c4: afb00018 sw r16,0x0018(r29)
  0018e8c8: 90860003 lbu r6,0x0003(r4) load job ID
+
  0018e8c8: 90860003 lbu r6,0x0003(r4) #r6  = Job ID
  0018e8cc: 90940012 lbu r20,0x0012(r4) load primary skillset
+
  0018e8cc: 90940012 lbu r20,0x0012(r4) #r20 = Primary skillset
  0018e8d0: 28c2004a slti r2,r6,0x004a
+
  0018e8d0: 28c2004a slti r2,r6,0x004a #Generic job check
  0018e8d4: 10400002 beq r2,r0,0x0018e8e0 branch if generic job
+
  0018e8d4: 10400002 beq r2,r0,0x0018e8e0 #Branch if generic job
  0018e8d8: 24c6ffb6 addiu r6,r6,0xffb6
+
  0018e8d8: 24c6ffb6 addiu r6,r6,0xffb6 #r6  = Job ID - 0x4a
  0018e8dc: 00003021 addu r6,r0,r0 default to squire
+
  0018e8dc: 00003021 addu r6,r0,r0 #r6  = 0 (default to squire if unique job)
  0018e8e0: 27a30010 addiu r3,r29,0x0010
+
  0018e8e0: 27a30010 addiu r3,r29,0x0010 #r3  = Modified stack pointer (r29 + 0x10)
  0018e8e4: 00061040 sll r2,r6,0x01 job ID*2
+
  0018e8e4: 00061040 sll r2,r6,0x01 #r2  = Job ID*2
  0018e8e8: 00461021 addu r2,r2,r6 job ID*3
+
  0018e8e8: 00461021 addu r2,r2,r6 #r2  = Job ID*3
  0018e8ec: 00441021 addu r2,r2,r4 job ID*3 + unit data
+
  0018e8ec: 00441021 addu r2,r2,r4 #r2  = Job ID*3 + unit data
  0018e8f0: 24450099 addiu r5,r2,0x0099 r5 = known abilities address
+
  0018e8f0: 24450099 addiu r5,r2,0x0099 #r5 = Known abilities pointer?
  0018e8f4: 27a70013 addiu r7,r29,0x0013
+
  0018e8f4: 27a70013 addiu r7,r29,0x0013 #r7  = Modified stack pointer (r29 + 0x13)
  0018e8f8: 90a20000 lbu r2,0x0000(r5)
+
 +
Store Known Abilities Loop:
 +
  0018e8f8: 90a20000 lbu r2,0x0000(r5) #r2  = Load known abilities?
 
  0018e8fc: 00000000 nop
 
  0018e8fc: 00000000 nop
  0018e900: a0620000 sb r2,0x0000(r3) store original known abilities?
+
  0018e900: a0620000 sb r2,0x0000(r3) #Store original known abilities?
  0018e904: 24630001 addiu r3,r3,0x0001
+
  0018e904: 24630001 addiu r3,r3,0x0001 #Move stack pointer
  0018e908: 0067102a slt r2,r3,r7
+
  0018e908: 0067102a slt r2,r3,r7 #Compare starting pointer to current pointer
  0018e90c: 1440fffa bne r2,r0,0x0018e8f8 do 13 times
+
  0018e90c: 1440fffa bne r2,r0,0x0018e8f8 #Loop 3 times
  0018e910: 24a50001 addiu r5,r5,0x0001
+
  0018e910: 24a50001 addiu r5,r5,0x0001 #r5  = Known abilities pointer + 1
  0018e914: 00008021 addu r16,r0,r0
+
  0018e918: 00061040 sll r2,r6,0x01 generic job ID*2
+
  0018e914: 00008021 addu r16,r0,r0 #r16 = Counter = 0
  0018e91c: 00461021 addu r2,r2,r6 generic job ID*3
+
  0018e918: 00061040 sll r2,r6,0x01 #r2  = Generic job ID*2
  0018e920: 00441021 addu r2,r2,r4
+
  0018e91c: 00461021 addu r2,r2,r6 #r2  = Generic job ID*3
  0018e924: 24530099 addiu r19,r2,0x0099 r19 = jobs ability pointer
+
  0018e920: 00441021 addu r2,r2,r4 #r2  = Generic job ID*3 + Unit data pointer
  0018e928: 06010002 bgez r16,0x0018e934 branch if counter positive
+
  0018e924: 24530099 addiu r19,r2,0x0099 #r19 = Job's ability pointer
  0018e92c: 02001821 addu r3,r16,r0
+
  0018e928: 06010002 bgez r16,0x0018e934 #Branch if counter is positive
  0018e930: 26030007 addiu r3,r16,0x0007 make positive
+
  0018e92c: 02001821 addu r3,r16,r0 #r3  = Current counter value
  0018e934: 000388c3 sra r17,r3,0x03 counter >> 0x03
+
  0018e930: 26030007 addiu r3,r16,0x0007 #r3  = Current counter value + 7 (make positive)
  0018e938: 001118c0 sll r3,r17,0x03 counter << 0x03 (removes 0x03 flag)
+
  0018e934: 000388c3 sra r17,r3,0x03 #r17 = Counter value / 8
  0018e93c: 02031823 subu r3,r16,r3 counter - counter << 0x03 (leaves only 0x03)
+
  0018e938: 001118c0 sll r3,r17,0x03 #r3  = Counter value (without 0x03 flag)
  0018e940: 34040080 ori r4,r0,0x0080
+
  0018e93c: 02031823 subu r3,r16,r3 #r3  = Counter - counter without 0x03 flags (leaves only 0x03 flags of counter)
  0018e944: 03b11021 addu r2,r29,r17
+
  0018e940: 34040080 ori r4,r0,0x0080 #r4  = 0x80
  0018e948: 90420010 lbu r2,0x0010(r2) load ??
+
  0018e944: 03b11021 addu r2,r29,r17 #r2  = Stack pointer + (Counter value / 8) ?
  0018e94c: 00649007 srav r18,r4,r3
+
  0018e948: 90420010 lbu r2,0x0010(r2) #r2  = ??
  0018e950: 00521024 and r2,r2,r18
+
  0018e94c: 00649007 srav r18,r4,r3 #r18 = ??
  0018e954: 1440000c bne r2,r0,0x0018e988 branch if known?
+
  0018e950: 00521024 and r2,r2,r18 #r2  = ??
  0018e958: 328400ff andi r4,r20,0x00ff
+
  0018e954: 1440000c bne r2,r0,0x0018e988 #Branch if known?
  0018e95c: 0c01695a jal 0x0005a568 load ability from skillset
+
  0018e958: 328400ff andi r4,r20,0x00ff #r4  = Primary skillset
  0018e960: 02002821 addu r5,r16,r0
+
  0018e95c: 0c01695a jal 0x0005a568 #[[Load Ability From Skillset]] routine
 +
  0018e960: 02002821 addu r5,r16,r0 #r5  = Current counter value
 
  0018e964: 3c038019 lui r3,0x8019
 
  0018e964: 3c038019 lui r3,0x8019
  0018e968: 84633d44 lh r3,0x3d44(r3) load used ability
+
  0018e968: 84633d44 lh r3,0x3d44(r3) #r3  = Used ability ID
  0018e96c: 3042ffff andi r2,r2,0xffff
+
  0018e96c: 3042ffff andi r2,r2,0xffff #r2  = Ability ID in current skillset at counter position
  0018e970: 14430005 bne r2,r3,0x0018e988 branch if not used ability
+
  0018e970: 14430005 bne r2,r3,0x0018e988 #Branch if not used ability
  0018e974: 02711821 addu r3,r19,r17 coutner >> 3 + unit data?
+
  0018e974: 02711821 addu r3,r19,r17 #r3  = (Counter / 8) + job's ability pointer
  0018e978: 90620000 lbu r2,0x0000(r3) load known abilities
+
  0018e978: 90620000 lbu r2,0x0000(r3) #r2  = Known abilities?
 
  0018e97c: 00000000 nop
 
  0018e97c: 00000000 nop
  0018e980: 02421025 or r2,r18,r2
+
  0018e980: 02421025 or r2,r18,r2 #r2  = ??
  0018e984: a0620000 sb r2,0x0000(r3) store ability learned
+
  0018e984: a0620000 sb r2,0x0000(r3) #Store ability learned?
  0018e988: 26100001 addiu r16,r16,0x0001 counter++
+
  0018e988: 26100001 addiu r16,r16,0x0001 #Counter ++
  0018e98c: 2a020018 slti r2,r16,0x0018 do for each action /R/S/M
+
  0018e98c: 2a020018 slti r2,r16,0x0018 #Check all abilities
  0018e990: 1440ffe5 bne r2,r0,0x0018e928
+
  0018e990: 1440ffe5 bne r2,r0,0x0018e928 #Loop until all abilities checked
 
  0018e994: 00000000 nop
 
  0018e994: 00000000 nop
 
  0018e998: 8fbf002c lw r31,0x002c(r29)
 
  0018e998: 8fbf002c lw r31,0x002c(r29)
Line 69: Line 73:
 
  0018e9b4: 03e00008 jr r31
 
  0018e9b4: 03e00008 jr r31
 
  0018e9b8: 00000000 nop
 
  0018e9b8: 00000000 nop
</font>
+
 +
==Return Locations==
 +
 
 +
00077a48: [[000779a0 - 00077b54]]

Latest revision as of 08:45, 14 May 2023

Parameters:
   #r4 = Unit data pointer?
0018e8ac: 27bdffd0 addiu r29,r29,0xffd0
0018e8b0: afbf002c sw r31,0x002c(r29)
0018e8b4: afb40028 sw r20,0x0028(r29)
0018e8b8: afb30024 sw r19,0x0024(r29)
0018e8bc: afb20020 sw r18,0x0020(r29)
0018e8c0: afb1001c sw r17,0x001c(r29)
0018e8c4: afb00018 sw r16,0x0018(r29)
0018e8c8: 90860003 lbu r6,0x0003(r4)			#r6  = Job ID
0018e8cc: 90940012 lbu r20,0x0012(r4)			#r20 = Primary skillset
0018e8d0: 28c2004a slti r2,r6,0x004a			#Generic job check
0018e8d4: 10400002 beq r2,r0,0x0018e8e0				#Branch if generic job
0018e8d8: 24c6ffb6 addiu r6,r6,0xffb6			#r6  = Job ID - 0x4a
0018e8dc: 00003021 addu r6,r0,r0			#r6  = 0 (default to squire if unique job)
0018e8e0: 27a30010 addiu r3,r29,0x0010			#r3  = Modified stack pointer (r29 + 0x10)
0018e8e4: 00061040 sll r2,r6,0x01			#r2  = Job ID*2
0018e8e8: 00461021 addu r2,r2,r6			#r2  = Job ID*3
0018e8ec: 00441021 addu r2,r2,r4			#r2  = Job ID*3 + unit data
0018e8f0: 24450099 addiu r5,r2,0x0099			#r5  = Known abilities pointer?
0018e8f4: 27a70013 addiu r7,r29,0x0013			#r7  = Modified stack pointer (r29 + 0x13)

Store Known Abilities Loop:
0018e8f8: 90a20000 lbu r2,0x0000(r5)			#r2  = Load known abilities?
0018e8fc: 00000000 nop
0018e900: a0620000 sb r2,0x0000(r3)			#Store original known abilities?
0018e904: 24630001 addiu r3,r3,0x0001			#Move stack pointer
0018e908: 0067102a slt r2,r3,r7				#Compare starting pointer to current pointer
0018e90c: 1440fffa bne r2,r0,0x0018e8f8				#Loop 3 times
0018e910: 24a50001 addiu r5,r5,0x0001			#r5  = Known abilities pointer + 1

0018e914: 00008021 addu r16,r0,r0			#r16 = Counter = 0
0018e918: 00061040 sll r2,r6,0x01			#r2  = Generic job ID*2
0018e91c: 00461021 addu r2,r2,r6			#r2  = Generic job ID*3
0018e920: 00441021 addu r2,r2,r4			#r2  = Generic job ID*3 + Unit data pointer
0018e924: 24530099 addiu r19,r2,0x0099			#r19 = Job's ability pointer
0018e928: 06010002 bgez r16,0x0018e934				#Branch if counter is positive
0018e92c: 02001821 addu r3,r16,r0			#r3  = Current counter value
0018e930: 26030007 addiu r3,r16,0x0007			#r3  = Current counter value + 7 (make positive)
0018e934: 000388c3 sra r17,r3,0x03			#r17 = Counter value / 8
0018e938: 001118c0 sll r3,r17,0x03			#r3  = Counter value (without 0x03 flag)
0018e93c: 02031823 subu r3,r16,r3			#r3  = Counter - counter without 0x03 flags (leaves only 0x03 flags of counter)
0018e940: 34040080 ori r4,r0,0x0080			#r4  = 0x80
0018e944: 03b11021 addu r2,r29,r17			#r2  = Stack pointer + (Counter value / 8) ?
0018e948: 90420010 lbu r2,0x0010(r2)			#r2  = ??
0018e94c: 00649007 srav r18,r4,r3			#r18 = ??
0018e950: 00521024 and r2,r2,r18			#r2  = ??
0018e954: 1440000c bne r2,r0,0x0018e988				#Branch if known?
0018e958: 328400ff andi r4,r20,0x00ff			#r4  = Primary skillset
0018e95c: 0c01695a jal 0x0005a568				#Load Ability From Skillset routine
0018e960: 02002821 addu r5,r16,r0			#r5  = Current counter value
0018e964: 3c038019 lui r3,0x8019
0018e968: 84633d44 lh r3,0x3d44(r3)			#r3  = Used ability ID
0018e96c: 3042ffff andi r2,r2,0xffff			#r2  = Ability ID in current skillset at counter position
0018e970: 14430005 bne r2,r3,0x0018e988				#Branch if not used ability
0018e974: 02711821 addu r3,r19,r17			#r3  = (Counter / 8) + job's ability pointer
0018e978: 90620000 lbu r2,0x0000(r3)			#r2  = Known abilities?
0018e97c: 00000000 nop
0018e980: 02421025 or r2,r18,r2				#r2  = ??
0018e984: a0620000 sb r2,0x0000(r3)			#Store ability learned?
0018e988: 26100001 addiu r16,r16,0x0001			#Counter ++
0018e98c: 2a020018 slti r2,r16,0x0018			#Check all abilities
0018e990: 1440ffe5 bne r2,r0,0x0018e928				#Loop until all abilities checked
0018e994: 00000000 nop
0018e998: 8fbf002c lw r31,0x002c(r29)
0018e99c: 8fb40028 lw r20,0x0028(r29)
0018e9a0: 8fb30024 lw r19,0x0024(r29)
0018e9a4: 8fb20020 lw r18,0x0020(r29)
0018e9a8: 8fb1001c lw r17,0x001c(r29)
0018e9ac: 8fb00018 lw r16,0x0018(r29)
0018e9b0: 27bd0030 addiu r29,r29,0x0030
0018e9b4: 03e00008 jr r31
0018e9b8: 00000000 nop

Return Locations

00077a48: 000779a0 - 00077b54