Routine that checks math skill IDS?

From Final Fantasy Hacktics Wiki
(Redirected from 00181f38 - 00182064)
Jump to navigation Jump to search
00181f38: 27bdff40 addiu r29,r29,0xff40		-0xc0 (from Skillset Loading?, -0xD8)
00181f3c: afb300b4 sw r19,0x00b4(r29)
00181f40: 00809821 addu r19,r4,r0		r19 = unit battle ID
00181f44: afb000a8 sw r16,0x00a8(r29)
00181f48: 00c08021 addu r16,r6,r0		r16 = spell list
00181f4c: afb200b0 sw r18,0x00b0(r29)
00181f50: 00009021 addu r18,r0,r0		r18 = 0
00181f54: afb100ac sw r17,0x00ac(r29)
00181f58: 00a08821 addu r17,r5,r0		r17 = skillset ID
00181f5c: afb400b8 sw r20,0x00b8(r29)
00181f60: afbf00bc sw r31,0x00bc(r29)
00181f64: 0c060435 jal 0x001810d4		Get Data Pointer
00181f68: 00e0a021 addu r20,r7,r0		r20 = 0x0f or 0xf0 (arithmetick primary/secondary menu check?)
00181f6c: 10400005 beq r2,r0,0x00181f84		branch if unit data pointer=0
00181f70: 322300ff andi r3,r17,0x00ff		r3 = primary skillset
00181f74: 34020015 ori r2,r0,0x0015		r2 = 15
00181f78: 10620004 beq r3,r2,0x00181f8c		jump if primary skillset=math skill
00181f7c: 2402ffff addiu r2,r0,0xffff			
00181f80: a6020000 sh r2,0x0000(r16 )			if skillset <> math skill, store no no ability IDs in spell list
00181f84: 08060811 j 0x00182044			jump to end if skillset != math  skill
00181f88: 00001021 addu r2,r0,r0			return no valid spells
00181f8c: 02602021 addu r4,r19,r0		r4 = unit battle ID
00181f90: 27a20060 addiu r2,r29,0x0060		
00181f94: afa20010 sw r2,0x0010(r29)		store stack + 0x60 for ability CT
00181f98: 27a20078 addiu r2,r29,0x0078
00181f9c: afa20018 sw r2,0x0018(r29)		store stack + 0x78 for silence/performance checks
00181fa0: 27a20090 addiu r2,r29,0x0090
00181fa4: 34050015 ori r5,r0,0x0015		skillset = math
00181fa8: 27a60020 addiu r6,r29,0x0020		stack + 0x20 for Ability IDs
00181fac: 27a70048 addiu r7,r29,0x0048		stack + 0x48 for MP costs
00181fb0: afa00014 sw r0,0x0014(r29)
00181fb4: 0c0605f0 jal 0x001817c0             Load ability data for skillset
00181fb8: afa2001c sw r2,0x001c(r29)		stack + 0x90 for #turns to complete
00181fbc: 00403021 addu r6,r2,r0
00181fc0: 10c0fff0 beq r6,r0,0x00181f84	branch if number of abilities in skillset is 0
00181fc4: 0246102a slt r2,r18,r6		r2 = true if 0 < No. abilities in skillset
00181fc8: 1040001b beq r2,r0,0x00182038	branch if not the case (less than 0 abilities? haha lmao)
00181fcc: 00002821 addu r5,r0,r0
00181fd0: 3408fe62 ori r8,r0,0xfe62		r8 = -0x019e
00181fd4: 3c078006 lui r7,0x8006
00181fd8: 24e70eb6 addiu r7,r7,0x0eb6		pointer to math IDs. off by 0x19e, the ID of multiple of 5
00181fdc: 27a40020 addiu r4,r29,0x0020		pointer to ability IDs
00181fe0: 94830000 lhu r3,0x0000(r4)		load ability ID
00181fe4: 00000000 nop
00181fe8: 00681021 addu r2,r3,r8
00181fec: 3042ffff andi r2,r2,0xffff		Ability ID - 0x19e (multiple of 5)
00181ff0: 2c420008 sltiu r2,r2,0x0008
00181ff4: 1040000c beq r2,r0,0x00182028		branch if skill is not math
00181ff8: 24840002 addiu r4,r4,0x0002		next ability ID in stack
00181ffc: 00031400 sll r2,r3,0x10
00182000: 00021403 sra r2,r2,0x10
00182004: 00471021 addu r2,r2,r7		Math table pointer
00182008: 90420000 lbu r2,0x0000(r2)		Load Arithmetik ID
0018200c: 00000000 nop
00182010: 00541024 and r2,r2,r20		primary/secondary menu check
00182014: 10400004 beq r2,r0,0x00182028	branch if in the wrong menu?
00182018: 00000000 nop
0018201c: a6030000 sh r3,0x0000(r16)		Store ability ID in Math Menu (if in correct menu)
00182020: 26100002 addiu r16,r16,0x0002	Spell list + 0x2
00182024: 26520001 addiu r18,r18,0x0001	increase number of valid abilities in list by 1
00182028: 24a50001 addiu r5,r5,0x0001		Increase counter by 1
0018202c: 00a6102a slt r2,r5,r6
00182030: 1440ffeb bne r2,r0,0x00181fe0	Loop until all abilities in skillset are checked
00182034: 00000000 nop
00182038: 2402ffff addiu r2,r0,0xffff
0018203c: a6020000 sh r2,0x0000(r16)		Store 0xffff in ability list (end list)
00182040: 02401021 addu r2,r18,r0		return number of valid abilities
00182044: 8fbf00bc lw r31,0x00bc(r29)
00182048: 8fb400b8 lw r20,0x00b8(r29)
0018204c: 8fb300b4 lw r19,0x00b4(r29)
00182050: 8fb200b0 lw r18,0x00b0(r29)
00182054: 8fb100ac lw r17,0x00ac(r29)
00182058: 8fb000a8 lw r16,0x00a8(r29)
0018205c: 27bd00c0 addiu r29,r29,0x00c0 
00182060: 03e00008 jr r31


Return Locations

00181efc: - Routine at 181ef0
00181f20: - Routine at 181f14