0012b354 - 0012b3fc: Accumulate unlocked jobs into one word

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search

< WORLD.BIN

Routine

0012b354: 10800028 beq r4,r0,0x0012b3f8		#branch if squire - routine returns success job open
0012b358: 00001021 addu r2,r0,r0

0012b35c: 3c028019 lui r2,0x8019
0012b360: 9042e47d lbu r2,-0x1b83(r2)
0012b364: 00000000 nop
0012b368: 10400006 beq r2,r0,0x0012b384		#control check?
0012b36c: 00003821 addu r7,r0,r0				clear results

0012b370: 34020007 ori r2,r0,0x0007
0012b374: 3c018019 lui r1,0x8019
0012b378: ac22e488 sw r2,-0x1b78(r1)			store 0x0007 (counter)
0012b37c: 3c018019 lui r1,0x8019
0012b380: a020e47d sb r0,-0x1b83(r1)			store 0 in control check

0012b384: 2484ffff addiu r4,r4,0xffff			job - 0x4a - 1
0012b388: 2402ffff addiu r2,r0,0xffff			
0012b38c: 1082001a beq r4,r2,0x0012b3f8		branch if no more jobs to check
0012b390: 00e01021 addu r2,r7,r0				result = 0
0012b394: 340a0001 ori r10,r0,0x0001
0012b398: 34090007 ori r9,r0,0x0007
0012b39c: 2408ffff addiu r8,r0,0xffff

0012b3a0: 3c06801d lui r6,0x801d
0012b3a4: 8cc6a6f4 lw r6,-0x590c(r6)			load pointer to unlocked jobs
0012b3a8: 3c038019 lui r3,0x8019
0012b3ac: 8c63e488 lw r3,-0x1b78(r3)			load bit comparison counter
0012b3b0: 90c20000 lbu r2,0x0000(r6)			load unlocked flags
0012b3b4: 2465ffff addiu r5,r3,0xffff			decrement bit comparison counter
0012b3b8: 3c018019 lui r1,0x8019
0012b3bc: ac25e488 sw r5,-0x1b78(r1)			store new control byte (bit to check for unlocked jobs)
0012b3c0: 00621007 srav r2,r2,r3				shift right by control byte
0012b3c4: 30420001 andi r2,r2,0x0001			check if job is unlocked
0012b3c8: 10400002 beq r2,r0,0x0012b3d4		if r2 = 0, skip result modification
0012b3cc: 008a1004 sllv r2,r10,r4				job number - 0x4a - 1 *2

0012b3d0: 00e23825 or r7,r7,r2					result = above shift operation

0012b3d4: 04a10006 bgez r5,0x0012b3f0			branch if not at the end
0012b3d8: 2484ffff addiu r4,r4,0xffff

0012b3dc: 24c20001 addiu r2,r6,0x0001			increment pointer
0012b3e0: 3c018019 lui r1,0x8019
0012b3e4: ac29e488 sw r9,-0x1b78(r1)			reset bit comparison counter
0012b3e8: 3c01801d lui r1,0x801d
0012b3ec: ac22a6f4 sw r2,-0x590c(r1)			store new unlocked jobs pointer

0012b3f0: 1488ffeb bne r4,r8,0x0012b3a0		branch if r4 is not 0xFFFF
0012b3f4: 00e01021 addu r2,r7,r0				return result (r2 = 0 success)

0012b3f8: 03e00008 jr r31
0012b3fc: 00000000 nop

Return locations

World.bin
0011d978: 0011d8ac - 0011dc6c
001224e4: Set Jobs unlocked by others (00122488 - 00122530)
001224ec: same as above
001302dc: 0012fdd8 - 00130334
001303c0: 00130338 - 00130894

Navigation

< 0012b298 - 0012b350 | 0012b400 - 0012b7dc >