Load Ability From Skillset

From Final Fantasy Hacktics Wiki
Revision as of 01:13, 29 February 2012 by Choto (talk | contribs)
Jump to navigation Jump to search
Load Ability From Skillset
0005a568: 288200b0 slti r2,r4,0x00b0
0005a56c: 10400017 beq r2,r0,0x0005a5cc		Branch if using a monster skillset
0005a570: 28a20016 slti r2,r5,0x0016
0005a574: 1040002d beq r2,r0,0x0005a62c		Branch if Counter >= 0x16
0005a578: 00a03021 addu r6,r5,r0		r6 = Counter
0005a57c: 3c038006 lui r3,0x8006
0005a580: 24634a94 addiu r3,r3,0x4a94
0005a584: 00041040 sll r2,r4,0x01		ID * 2
0005a588: 00441021 addu r2,r2,r4		ID * 3
0005a58c: 000210c0 sll r2,r2,0x03		ID * 24
0005a590: 00441021 addu r2,r2,r4		ID * 25
0005a594: 04a10002 bgez r5,0x0005a5a0		Branch if Counter >= 0
0005a598: 00432021 addu r4,r2,r3		r4 = Pointer to Skillsets
0005a59c: 24a60007 addiu r6,r5,0x0007		r6 = Counter + 7
0005a5a0: 000618c3 sra r3,r6,0x03		Counter / 8 (byte to load)
0005a5a4: 00831021 addu r2,r4,r3
0005a5a8: 000318c0 sll r3,r3,0x03		Counter / 8 * 8
0005a5ac: 00a31823 subu r3,r5,r3		r3 = Counter - Counter / 8 * 8
0005a5b0: 90420000 lbu r2,0x0000(r2)		Load Ability Flag s
0005a5b4: 24630001 addiu r3,r3,0x0001		C Mod = (Counter - Counter / 8 *  8) + 1
0005a5b8: 00621004 sllv r2,r2,r3		Ability Flags * 2^(C Mod)
0005a5bc: 00851821 addu r3,r4,r5		r3 = Ability ID Pointer
0005a5c0: 90630003 lbu r3,0x0003(r3)		Load Ability ID
0005a5c4: 08016989 j 0x0005a624
0005a5c8: 30420100 andi r2,r2,0x0100		r2 = Ability ID +0x100 flag
0005a5cc: 288200e0 slti r2,r4,0x00e0
0005a5d0: 10400016 beq r2,r0,0x0005a62c		Branch if not a monster skillset
0005a5d4: 28a20004 slti r2,r5,0x0004
0005a5d8: 10400014 beq r2,r0,0x0005a62c		Branch if Counter >= 4
0005a5dc: 00a03021 addu r6,r5,r0		r6 = Counter
0005a5e0: 3c038006 lui r3,0x8006
0005a5e4: 24635854 addiu r3,r3,0x5854		(start back some instead of subtracting)
0005a5e8: 00041080 sll r2,r4,0x02		Skillset * 4
0005a5ec: 00441021 addu r2,r2,r4		Skillset * 5
0005a5f0: 04a10002 bgez r5,0x0005a5fc		Branch if Counter >= 0
0005a5f4: 00432021 addu r4,r2,r3
0005a5f8: 24a60007 addiu r6,r5,0x0007
0005a5fc: 000618c3 sra r3,r6,0x03		Counter / 8
0005a600: 00831021 addu r2,r4,r3		
0005a604: 000318c0 sll r3,r3,0x03		Counter / 8 * 8
0005a608: 00a31823 subu r3,r5,r3		Counter - Counter / 8 * 8
0005a60c: 90420000 lbu r2,0x0000(r2)		Load Ability Flags
0005a610: 24630001 addiu r3,r3,0x0001		C Mod = (Counter - Counter / 8 * 8) + 1
0005a614: 00621004 sllv r2,r2,r3		Ability Flags * 2^(C Mod)
0005a618: 00851821 addu r3,r4,r5
0005a61c: 90630001 lbu r3,0x0001(r3)		Load Ability ID
0005a620: 30420100 andi r2,r2,0x0100		r2 = Ability ID's 0x100 Flag
0005a624: 0801698c j 0x0005a630
0005a628: 00621025 or r2,r3,r2			r2 = Full Ability ID (Base ID +  0x100 flag)
0005a62c: 00001021 addu r2,r0,r0		r2 = 0 (Attack)
0005a630: 03e00008 jr r31
0005a634: 00000000 nop


Return Locations

0005a67c:  Store Skillset's Abilities
0005cfac:  Calculate Learned Abilities
0005d268:  Calculate Unit's R/S/M
001807bc:  Generate Crystal or Treasure
00181994: 001817c0
00182378: 001822cc
0018e828: 0018e6b8
0018e95c: 0018e8ac