Main Skillset/ability loading

From Final Fantasy Hacktics Wiki
Jump to: navigation, search
0013fa6c: 3c028017 lui r2,0x8017
0013fa70: 8c424048 lw r2,0x4048(r2)			load Skillset display address
0013fa74: 27bdffa8 addiu r29,r29,0xffa8
0013fa78: afb20040 sw r18,0x0040(r29)
0013fa7c: 3c128015 lui r18,0x8015
0013fa80: 8652d08a lh r18,-0x2f76(r18)		load attacker battle ID
0013fa84: afb5004c sw r21,0x004c(r29)
0013fa88: afbf0054 sw r31,0x0054(r29)
0013fa8c: afb60050 sw r22,0x0050(r29)
0013fa90: afb40048 sw r20,0x0048(r29)
0013fa94: afb30044 sw r19,0x0044(r29)
0013fa98: afb1003c sw r17,0x003c(r29)
0013fa9c: afb00038 sw r16,0x0038(r29)
0013faa0: 244300a4 addiu r3,r2,0x00a4		Store "Stock" "Mp" pointer
0013faa4: 3c018016 lui r1,0x8016
0013faa8: ac2269a4 sw r2,0x69a4(r1)			store skillset ability list pointer
0013faac: 24420148 addiu r2,r2,0x0148
0013fab0: 3c018016 lui r1,0x8016
0013fab4: ac2369a8 sw r3,0x69a8(r1)			store pointer to list of data after skillset abilities
0013fab8: 3c018016 lui r1,0x8016
0013fabc: ac2269ac sw r2,0x69ac(r1)			Store pointer to Turns data
0013fac0: 0c04b7d0 jal 0x0012df40			get Attacker's data pointer
0013fac4: 0080a821 addu r21,r4,r0			r21 = PV
0013fac8: 0040b021 addu r22,r2,r0			r22 = unit data
0013facc: 00002821 addu r5,r0,r0
0013fad0: 3409ffff ori r9,r0,0xffff
0013fad4: 3c028017 lui r2,0x8017
0013fad8: 8c423cb8 lw r2,0x3cb8(r2)			load menu data
0013fadc: 340800ff ori r8,r0,0x00ff
0013fae0: 84420128 lh r2,0x0128(r2)			load action menu byte
0013fae4: 34070001 ori r7,r0,0x0001
0013fae8: 3c018017 lui r1,0x8017
0013faec: 00220821 addu r1,r1,r2
0013faf0: 9031404c lbu r17,0x404c(r1)		load action menu byte?
0013faf4: 3c018017 lui r1,0x8017
0013faf8: 00220821 addu r1,r1,r2
0013fafc: 90304060 lbu r16,0x4060(r1)		load skillset
0013fb00: 3c068015 lui r6,0x8015
0013fb04: 24c6d264 addiu r6,r6,0xd264
0013fb08: 3c018017 lui r1,0x8017
0013fb0c: a030982d sb r16,-0x67d3(r1)		store skillset

<Loop> Initialize display data

0013fb10: 3c038017 lui r3,0x8017
0013fb14: 8c634048 lw r3,0x4048(r3)			r3 = Ability list
0013fb18: 00052040 sll r4,r5,0x01
0013fb1c: 00831021 addu r2,r4,r3
0013fb20: 00651821 addu r3,r3,r5
0013fb24: a4490000 sh r9,0x0000(r2)			store ability = 0xff
0013fb28: a06801ec sb r8,0x01ec(r3)			store 0xff into 0x1ec past ability list
0013fb2c: 3c028017 lui r2,0x8017
0013fb30: 8c424048 lw r2,0x4048(r2)			load ability list
0013fb34: 00000000 nop
0013fb38: 00451021 addu r2,r2,r5
0013fb3c: a047023e sb r7,0x023e(r2)			store 01 in ability CT
0013fb40: 3c028017 lui r2,0x8017
0013fb44: 8c424048 lw r2,0x4048(r2)			load ability list
0013fb48: 00000000 nop
0013fb4c: 00822021 addu r4,r4,r2
0013fb50: 00451021 addu r2,r2,r5
0013fb54: a48000a4 sh r0,0x00a4(r4)			clear "stock" "mp"
0013fb58: a4890148 sh r9,0x0148(r4)			
0013fb5c: a0400290 sb r0,0x0290(r2)			
0013fb60: 3c028017 lui r2,0x8017
0013fb64: 8c424048 lw r2,0x4048(r2)			load ability list
0013fb68: 00000000 nop
0013fb6c: 00451021 addu r2,r2,r5
0013fb70: a04702e2 sb r7,0x02e2(r2)			
0013fb74: 3c028017 lui r2,0x8017
0013fb78: 8c424048 lw r2,0x4048(r2)			...and again
0013fb7c: 00000000 nop
0013fb80: 00451021 addu r2,r2,r5
0013fb84: a0480334 sb r8,0x0334(r2)			store CT list = 0xFF
0013fb88: a4c00000 sh r0,0x0000(r6)			r6 = 146214
0013fb8c: 24a50001 addiu r5,r5,0x0001
0013fb90: 28a20050 slti r2,r5,0x0050
0013fb94: 1440ffde bne r2,r0,0x 0013fb10		run 80 times
0013fb98: 24c60002 addiu r6,r6,0x0002

</Loop> Set end of lists

0013fb9c: 3c028017 lui r2,0x8017
0013fba0: 8c424048 lw r2,0x4048(r2)
0013fba4: 340300ff ori r3,r0,0x00ff
0013fba8: a043023c sb r3,0x023c(r2)			
0013fbac: 3c028017 lui r2,0x8017
0013fbb0: 8c424048 lw r2,0x4048(r2)
0013fbb4: 00000000 nop
0013fbb8: a043028e sb r3,0x028e(r2)
0013fbbc: 3c028017 lui r2,0x8017
0013fbc0: 8c424048 lw r2,0x4048(r2)
0013fbc4: 00000000 nop
0013fbc8: a04302e0 sb r3,0x02e0(r2)
0013fbcc: 3c028017 lui r2,0x8017
0013fbd0: 8c424048 lw r2,0x4048(r2)
0013fbd4: 00000000 nop
0013fbd8: a0430332 sb r3,0x0332(r2)
0013fbdc: 3c028017 lui r2,0x8017
0013fbe0: 8c424048 lw r2,0x4048(r2)------------initialize bytes = 0xff
    • Section 1 - Load ability-relevant data**


0013fbe4: 16200014 bne r17,r0,0x 0013fc38		branch if not default
0013fbe8: a0430384 sb r3,0x0384(r2)
0013fbec: 02402021 addu r4,r18,r0				r4 = attacker ID
0013fbf0: 3c068017 lui r6,0x8017
0013fbf4: 8cc64048 lw r6,0x4048(r6)
0013fbf8: 02002821 addu r5,r16,r0				r5 = skillset
0013fbfc: afa00014 sw r0,0x0014(r29)
0013fc00: 24c701ec addiu r7,r6,0x01ec			Mp Cost
0013fc04: 24c2023e addiu r2,r6,0x023e			Ability CT
0013fc08: afa20010 sw r2,0x0010(r29)
0013fc0c: 24c20290 addiu r2,r6,0x0290			Silence/persevere/Reflect
0013fc10: afa20018 sw r2,0x0018(r29)
0013fc14: 24c202e2 addiu r2,r6,0x02e2			Turns
0013fc18: 0c0605f0 jal 0x001817c0				load ability data for skillset display (loads to 19f3c4 list)
0013fc1c: afa2001c sw r2,0x001c(r29)
0013fc20: 3c058017 lui r5,0x8017
0013fc24: 8ca54048 lw r5,0x4048(r5)
0013fc28: 34060050 ori r6,r0,0x0050
0013fc2c: 24a40334 addiu r4,r5,0x0334			Now/Turn display
0013fc30: 0c052fd5 jal 0x0014bf54				store r5 into r4
0013fc34: 24a5023e addiu r5,r5,0x023e

Item Inventory

0013fc38: 34140001 ori r20,r0,0x0001
0013fc3c: 16340007 bne r17,r20,0x 0013fc5c		branch if not item
0013fc40: 34130002 ori r19,r0,0x0002
0013fc44: 02402021 addu r4,r18,r0				r4 = unit ID
0013fc48: 3c068017 lui r6,0x8017
0013fc4c: 8cc64048 lw r6,0x4048(r6)
0013fc50: 02002821 addu r5,r16,r0
0013fc54: 0c0606dc jal 0x00181b70				Load ability data for Item Inventory
0013fc58: 24c601ec addiu r6,r6,0x01ec			Item Used List

Weapon Inventory

0013fc5c: 16330008 bne r17,r19,0x 0013fc80		branch if not throw
0013fc60: 34020003 ori r2,r0,0x0003
0013fc64: 02402021 addu r4,r18,r0
0013fc68: 3c068017 lui r6,0x8017
0013fc6c: 8cc64048 lw r6,0x4048(r6)
0013fc70: 02002821 addu r5,r16,r0				skillset
0013fc74: 0c06072e jal 0x00181cb8				Throw
0013fc78: 24c601ec addiu r6,r6,0x01ec
0013fc7c: 34020003 ori r2,r0,0x0003

Math Skill r21 = which menu to load 0x02 - first set of parameters 0x01 - second set of parameters 0x00 - abilities

0013fc80: 16220014 bne r17,r2,0x 0013fcd4		branch if not math skill
0013fc84: 00000000 nop
0013fc88: 16b30005 bne r21,r19,0x 0013fca0		branch if not loading first set of parameters
0013fc8c: 02402021 addu r4,r18,r0				r4 = attacker ID
0013fc90: 3c068017 lui r6,0x8017
0013fc94: 8cc64048 lw r6,0x4048(r6)				load pointer to ability list
0013fc98: 0c0607bc jal 0x00181ef0				load Math skill parameters 1
0013fc9c: 02002821 addu r5,r16,r0				r5 = skillset
0013fca0: 16b40005 bne r21,r20,0x 0013fcb8		branch if not loading second set of parameters
0013fca4: 02402021 addu r4,r18,r0
0013fca8: 3c068017 lui r6,0x8017
0013fcac: 8cc64048 lw r6,0x4048(r6)
0013fcb0: 0c0607c5 jal 0x00181f14				load Math skill parameters 2
0013fcb4: 02002821 addu r5,r16,r0
0013fcb8: 16a00007 bne r21,r0,0x 0013fcd8		branch if not loading abilities
0013fcbc: 34020006 ori r2,r0,0x0006
0013fcc0: 02402021 addu r4,r18,r0
0013fcc4: 3c068017 lui r6,0x8017
0013fcc8: 8cc64048 lw r6,0x4048(r6)
0013fccc: 0c06081a jal 0x00182068				load math skill abilities?
0013fcd0: 02002821 addu r5,r16,r0


0013fcd4: 34020006 ori r2,r0,0x0006
0013fcd8: 1622000a bne r17,r2,0x 0013fd04
0013fcdc: 34020007 ori r2,r0,0x0007
0013fce0: 02402021 addu r4,r18,r0
0013fce4: 02002821 addu r5,r16,r0
0013fce8: 3c068017 lui r6,0x8017
0013fcec: 8cc64048 lw r6,0x4048(r6)
0013fcf0: 00003821 addu r7,r0,r0
0013fcf4: 24c20290 addiu r2,r6,0x0290
0013fcf8: 0c0608b3 jal 0x001822cc				monster skill/frog attack ability loading
0013fcfc: afa20010 sw r2,0x0010(r29)
0013fd00: 34020007 ori r2,r0,0x0007

Katana Inventory

0013fd04: 16220008 bne r17,r2,0x 0013fd28
0013fd08: 3402000a ori r2,r0,0x000a
0013fd0c: 02402021 addu r4,r18,r0
0013fd10: 3c068017 lui r6,0x8017
0013fd14: 8cc64048 lw r6,0x4048(r6)				load skillset
0013fd18: 02002821 addu r5,r16,r0
0013fd1c: 0c060999 jal 0x00182664				Draw Out
0013fd20: 24c601ec addiu r6,r6,0x01ec			used item list
0013fd24: 3402000a ori r2,r0,0x000a


0013fd28: 16220010 bne r17,r2,0x 0013fd6c
0013fd2c: 34020003 ori r2,r0,0x0003
0013fd30: 02402021 addu r4,r18,r0
0013fd34: 3c068017 lui r6,0x8017
0013fd38: 8cc64048 lw r6,0x4048(r6)
0013fd3c: 02002821 addu r5,r16,r0
0013fd40: 24c701ec addiu r7,r6,0x01ec			Turns
0013fd44: 24c202e2 addiu r2,r6,0x02e2			Turns
0013fd48: 0c0609ed jal 0x001827b4				Set Ability Data
0013fd4c: afa20010 sw r2,0x0010(r29)
0013fd50: 3c058017 lui r5,0x8017
0013fd54: 8ca54048 lw r5,0x4048(r5)
0013fd58: 34060050 ori r6,r0,0x0050
0013fd5c: 24a40334 addiu r4,r5,0x0334			Ability CT?
0013fd60: 0c052fd5 jal 0x0014bf54				store r5 into r4
0013fd64: 24a501ec addiu r5,r5,0x01ec
0013fd68: 34020003 ori r2,r0,0x0003


0013fd6c: 12220002 beq r17,r2,0x 0013fd78		branch if Math skill
0013fd70: 341200ac ori r18,r0,0x00ac
0013fd74: 0000a821 addu r21,r0,r0
0013fd78: 34020003 ori r2,r0,0x0003
0013fd7c: 3c018016 lui r1,0x8016
0013fd80: a42269a0 sh r2,0x69a0(r1)				store stock/mp/turns display
0013fd84: 3c018016 lui r1,0x8016
0013fd88: a42269a2 sh r2,0x69a2(r1)				store stock/mp/turns display
0013fd8c: 3402006a ori r2,r0,0x006a
0013fd90: 3c018016 lui r1,0x8016
0013fd94: a422699a sh r2,0x699a(r1)				store MP display X offset
0013fd98: 3402007e ori r2,r0,0x007e
0013fd9c: 3c018016 lui r1,0x8016
0013fda0: a422699c sh r2,0x699c(r1)				store turn display X offset
0013fda4: 00111080 sll r2,r17,0x02				action menu byte * 4
0013fda8: 3c018016 lui r1,0x8016
0013fdac: a420699e sh r0,0x699e(r1)				store Ability name display
0013fdb0: 3c018017 lui r1,0x8017
0013fdb4: 00220821 addu r1,r1,r2				
0013fdb8: 84239266 lh r3,-0x6d9a(r1)			80169266 + Action menu byte*4

Default - 0x0000 Item Inventory - 0001 Throw - 0001 Math Skill - 0000 Elemental - 0000 Blank - 0000 Monster - 0000 Katana - 0001 Attack - 0000 Jump - 0000 Charge - 0000 Defend - 0000 Equip Change - 0000 Unknown - 0000 Blank - 0000 Unknown - 0000

    • 2nd Section - ** Set Usabilities
0013fdbc: 34020001 ori r2,r0,0x0001
0013fdc0: 14620048 bne r3,r2,0x 0013fee4			branch if not Item/Throw/Draw out
0013fdc4: 00003021 addu r6,r0,r0

Item/Throw/Draw Out - Set usability based on item quantity

0013fdc8: 3c048017 lui r4,0x8017
0013fdcc: 8c844048 lw r4,0x4048(r4)				load ability list address
0013fdd0: 0c04fe80 jal 0x 0013fa00				Store used items into ability list
0013fdd4: 248501ec addiu r5,r4,0x01ec			Item Used
0013fdd8: 00408021 addu r16,r2,r0				r16 = # of abilities
0013fddc: 3c058017 lui r5,0x8017
0013fde0: 8ca54048 lw r5,0x4048(r5)				load skillset data
0013fde4: 02003021 addu r6,r16,r0				
0013fde8: 24a40148 addiu r4,r5,0x0148			r4 = "Turns"
0013fdec: 0c04fe8e jal 0x 0013fa38				do for each r6, load from r5, store in r4 **Set Turns**
0013fdf0: 24a502e2 addiu r5,r5,0x02e2			r5 = turns
0013fdf4: 00003021 addu r6,r0,r0
0013fdf8: 1a000019 blez r16,0x 0013fe60			branch if no abilities found
0013fdfc: 00002821 addu r5,r0,r0
0013fe00: 34070004 ori r7,r0,0x0004
0013fe04: 3c048015 lui r4,0x8015
0013fe08: 2484d264 addiu r4,r4,0xd264			load availability Data
0013fe0c: 3c038017 lui r3,0x8017
0013fe10: 8c634048 lw r3,0x4048(r3)

<Loop> Grey Out item abilities>

0013fe14: 00000000 nop
0013fe18: 94620000 lhu r2,0x0000(r3)			load ability
0013fe1c: 3c018006 lui r1,0x8006
0013fe20: 00220821 addu r1,r1,r2
0013fe24: 902296e0 lbu r2,-0x6920(r1)			load item quantity
0013fe28: 00000000 nop
0013fe2c: a46200a4 sh r2,0x00a4(r3)				store item quantity
0013fe30: 946200a4 lhu r2,0x00a4(r3)			load item quantity
0013fe34: 00000000 nop
0013fe38: 14400003 bne r2,r0,0x 0013fe48			branch if not 0
0013fe3c: 00000000 nop
0013fe40: 0804ff93 j 0x 0013fe4c
0013fe44: a4870000 sh r7,0x0000(r4)				store grayed out ability

if item quantity != 0

0013fe48: 34060001 ori r6,r0,0x0001				set ability usable?
0013fe4c: 24840002 addiu r4,r4,0x0002
0013fe50: 24a50001 addiu r5,r5,0x0001
0013fe54: 00b0102a slt r2,r5,r16
0013fe58: 1440ffee bne r2,r0,0x 0013fe14			do for all abilities
0013fe5c: 24630002 addiu r3,r3,0x0002


0013fe60: 10c00003 beq r6,r0,0x 0013fe70			branch if have no items
0013fe64: 34070007 ori r7,r0,0x0007
0013fe68: 0804ffa7 j 0x 0013fe9c
0013fe6c: 2652fffc addiu r18,r18,0xfffc

if no items with quantity > 0 found

0013fe70: 02003021 addu r6,r16,r0
0013fe74: 34120094 ori r18,r0,0x0094
0013fe78: 3c058017 lui r5,0x8017
0013fe7c: 8ca54048 lw r5,0x4048(r5)				r5 = skillset abilities
0013fe80: 34020002 ori r2,r0,0x0002
0013fe84: 3c018016 lui r1,0x8016
0013fe88: a42269a2 sh r2,0x69a2(r1)				Remove "stock" display numbers
0013fe8c: 24a400a4 addiu r4,r5,0x00a4			r4 = item quantities
0013fe90: 0c04fe8e jal 0x 0013fa38				set turns = 1 (now)?
0013fe94: 24a502e2 addiu r5,r5,0x02e2			r5 = 01 data
0013fe98: 34070008 ori r7,r0,0x0008


0013fe9c: 34093800 ori r9,r0,0x3800				Store Item display
0013fea0: 3c048016 lui r4,0x8016
0013fea4: 2484699a addiu r4,r4,0x699a			8016699a
0013fea8: 94820000 lhu r2,0x0000(r4)			load Stock numbers display location
0013feac: 3c038016 lui r3,0x8016
0013feb0: 9463699c lhu r3,0x699c(r3)			load Turns display location
0013feb4: 2442fffc addiu r2,r2,0xfffc			move left by 4
0013feb8: 2463fffc addiu r3,r3,0xfffc			move left by 4
0013febc: a4820000 sh r2,0x0000(r4)				store new location
0013fec0: 34020007 ori r2,r0,0x0007
0013fec4: 3c018016 lui r1,0x8016
0013fec8: a423699c sh r3,0x699c(r1)				store new location
0013fecc: 1622005e bne r17,r2,0x 00140048		branch if not Draw out
0013fed0: 34060011 ori r6,r0,0x0011				Item/Throw
0013fed4: 08050012 j 0x 00140048					
0013fed8: 34060017 ori r6,r0,0x0017				Katana
0013fedc: 0804ffd5 j 0x 0013ff54					Skip Next Section
0013fee0: 34060001 ori r6,r0,0x0001

Not Item/throw/draw out -- Count numebr of abilities

0013fee4: 00008021 addu r16,r0,r0				
0013fee8: 3404ffff ori r4,r0,0xffff
0013feec: 3c038017 lui r3,0x8017
0013fef0: 8c634048 lw r3,0x4048(r3)				Load ability list
0013fef4: 00000000 nop
0013fef8: 94620000 lhu r2,0x0000(r3)			load ability
0013fefc: 00000000 nop
0013ff00: 10440005 beq r2,r4,0x 0013ff18			branch if ability doesn't exist
0013ff04: 00000000 nop
0013ff08: 26100001 addiu r16,r16,0x0001
0013ff0c: 2a020040 slti r2,r16,0x0040			set if counter in ability list bounds
0013ff10: 1440fff8 bne r2,r0,0x 0013fef4			branch back if so
0013ff14: 24630002 addiu r3,r3,0x0002			list++
0013ff18: 1620000f bne r17,r0,0x 0013ff58		branch if not using Default
0013ff1c: 34020003 ori r2,r0,0x0003
0013ff20: 1a00000d blez r16,0x 0013ff58			branch if no abilities found
0013ff24: 00002821 addu r5,r0,r0


0013ff28: 3c038017 lui r3,0x8017
0013ff2c: 8c634048 lw r3,0x4048(r3)				load ability list
0013ff30: 00000000 nop
0013ff34: 00651021 addu r2,r3,r5

<Loop> Load able to use byte>

0013ff38: 904201ec lbu r2,0x01ec(r2)			load 0x1ec byte (able to use ability?
0013ff3c: 00000000 nop
0013ff40: 1440ffe6 bne r2,r0,0x 0013fedc			branch if unable to use?
0013ff44: 24a50001 addiu r5,r5,0x0001			counter++
0013ff48: 00b0102a slt r2,r5,r16				set if in bounds?
0013ff4c: 1440fffa bne r2,r0,0x 0013ff38			branch if so
0013ff50: 00651021 addu r2,r3,r5
0013ff54: 34020003 ori r2,r0,0x0003
0013ff58: 1622000a bne r17,r2,0x 0013ff84		branch if not using Math Skill
0013ff5c: 00000000 nop

Math Skill

0013ff60: 1aa00008 blez r21,0x 0013ff84			Branch if loading abilities
0013ff64: 34020002 ori r2,r0,0x0002
0013ff68: 34120088 ori r18,r0,0x0088
0013ff6c: 3c018016 lui r1,0x8016
0013ff70: a42269a0 sh r2,0x69a0(r1)				store 0x0002
0013ff74: 3c018016 lui r1,0x8016
0013ff78: a42269a2 sh r2,0x69a2(r1)				store 0x0002
0013ff7c: 08050010 j 0x 00140040
0013ff80: 34070009 ori r7,r0,0x0009				jump down, Set control value = 0x09

Item - Throw - Draw Out - Default

0013ff84: 10c00019 beq r6,r0,0x 0013ffec			branch if not item/throw/draw out
0013ff88: 00000000 nop
0013ff8c: 16200018 bne r17,r0,0x 0013fff0		branch if not default
0013ff90: 02003021 addu r6,r16,r0				For Each Ability


0013ff94: 3c058017 lui r5,0x8017
0013ff98: 8ca54048 lw r5,0x4048(r5)				load Ability List
0013ff9c: 2652fff8 addiu r18,r18,0xfff8
0013ffa0: 24a400a4 addiu r4,r5,0x00a4			"Stock", "MP" List
0013ffa4: 0c04fe80 jal 0x 0013fa00				Set MP Values
0013ffa8: 24a501ec addiu r5,r5,0x01ec			Items used list, MP list
0013ffac: 3c058017 lui r5,0x8017
0013ffb0: 8ca54048 lw r5,0x4048(r5)
0013ffb4: 02003021 addu r6,r16,r0				For Each Ability
0013ffb8: 24a40148 addiu r4,r5,0x0148			Turns
0013ffbc: 0c04fe8e jal 0x 0013fa38				store turns
0013ffc0: 24a502e2 addiu r5,r5,0x02e2			Turns
0013ffc4: 34070006 ori r7,r0,0x0006
0013ffc8: 3c048016 lui r4,0x8016
0013ffcc: 2484699a addiu r4,r4,0x699a			8016699a
0013ffd0: 94820000 lhu r2,0x0000(r4)
0013ffd4: 3c038016 lui r3,0x8016
0013ffd8: 9463699c lhu r3,0x699c(r3)
0013ffdc: 2442fff8 addiu r2,r2,0xfff8			r2 -= 0x08
0013ffe0: 2463fff8 addiu r3,r3,0xfff8			r3 -= 0x08
0013ffe4: 0805000e j 0x 00140038
0013ffe8: a4820000 sh r2,0x0000(r4)

Anything Else

0013ffec: 02003021 addu r6,r16,r0
0013fff0: 3c058017 lui r5,0x8017
0013fff4: 8ca54048 lw r5,0x4048(r5)
0013fff8: 34120094 ori r18,r0,0x0094
0013fffc: 24a400a4 addiu r4,r5,0x00a4			"Stock, "MP"
00140000: 0c04fe8e jal 0x 0013fa38
00140004: 24a502e2 addiu r5,r5,0x02e2			Used Item List, Mp List
00140008: 34070005 ori r7,r0,0x0005
0014000c: 34020002 ori r2,r0,0x0002
00140010: 3c018016 lui r1,0x8016
00140014: a42269a2 sh r2,0x69a2(r1)				store no stock/mp display?
00140018: 3c028016 lui r2,0x8016
0014001c: 9442699a lhu r2,0x699a(r2)			load mp/stock display location
00140020: 3c038016 lui r3,0x8016
00140024: 9463699c lhu r3,0x699c(r3)			turns display location
00140028: 2442fffc addiu r2,r2,0xfffc			
0014002c: 2463fffc addiu r3,r3,0xfffc			move to the left by 4
00140030: 3c018016 lui r1,0x8016
00140034: a422699a sh r2,0x699a(r1)				store new

Default Return

00140038: 3c018016 lui r1,0x8016
0014003c: a423699c sh r3,0x699c(r1)				store new display location
00140040: 34097000 ori r9,r0,0x7000				store ability type
00140044: 34060005 ori r6,r0,0x0005
00140048: 3c028017 lui r2,0x8017
0014004c: 8c423cb8 lw r2,0x3cb8(r2)				80166b10 - Menu Data
00140050: 00002821 addu r5,r0,r0
00140054: a45200b8 sh r18,0x00b8(r2)			store unit ID 3 times?
00140058: a45200c0 sh r18,0x00c0(r2)
0014005c: a45200c8 sh r18,0x00c8(r2)
00140060: a44700e0 sh r7,0x00e0(r2)				store menu headers set
00140064: 1a000031 blez r16,0x 0014012c			branch if no abilities found
00140068: a44600ee sh r6,0x00ee(r2)				store skillset type?
0014006c: 34080008 ori r8,r0,0x0008
00140070: 340a0006 ori r10,r0,0x0006
00140074: 3c068017 lui r6,0x8017
00140078: 8cc64048 lw r6,0x4048(r6)				load skillset address
0014007c: 3c078015 lui r7,0x8015
00140080: 24e7d264 addiu r7,r7,0xd264			14d264
00140084: 00c02021 addu r4,r6,r0	

<Loop> Set usability for default abilities based on MP

00140088: 94c20000 lhu r2,0x0000(r6)			load ability ID
0014008c: 00000000 nop
00140090: 00491025 or r2,r2,r9					Add ability type flags
00140094: 1620000e bne r17,r0,0x 001400d0		branch if not default
00140098: a4c20000 sh r2,0x0000(r6)				store ability with type flags


0014009c: 96c2002c lhu r2,0x002c(r22)			load MP
001400a0: 908301ec lbu r3,0x01ec(r4)			load MP cost?
001400a4: 00000000 nop
001400a8: 00431023 subu r2,r2,r3				MP - MP cost
001400ac: 04410006 bgez r2,0x 001400c8			branch if unit has enough MP
001400b0: 00000000 nop
001400b4: 90820334 lbu r2,0x0334(r4)			load displayed turns until resolution
001400b8: 00000000 nop
001400bc: 10400002 beq r2,r0,0x 001400c8			branch if acting now
001400c0: 00000000 nop
001400c4: a4e80000 sh r8,0x0000(r7)				set ability blinking red
001400c8: 12200003 beq r17,r0,0x 001400d8		branch if default
001400cc: 00000000 nop
001400d0: 162a0010 bne r17,r10,0x 00140114		branch if not Monster
001400d4: 00000000 nop

Default and Monster

001400d8: 90820290 lbu r2,0x0290(r4)			load silence/persevere/reflect flags		
001400dc: 00000000 nop
001400e0: 30420002 andi r2,r2,0x0002
001400e4: 1040000b beq r2,r0,0x 00140114			branch if not silence-affected
001400e8: 00000000 nop
001400ec: 90820334 lbu r2,0x0334(r4)			load displayed turns until resolution
001400f0: 00000000 nop
001400f4: 10400007 beq r2,r0,0x 00140114			branch if ability acts now
001400f8: 00000000 nop
001400fc: 92c20059 lbu r2,0x0059(r22)			load status
00140100: 00000000 nop
00140104: 30420008 andi r2,r2,0x0008
00140108: 10400002 beq r2,r0,0x 00140114			branch if not silenced
0014010c: 00000000 nop
00140110: a4e80000 sh r8,0x0000(r7)				set skill blinking red (0x08)
00140114: 24e70002 addiu r7,r7,0x0002
00140118: 24840001 addiu r4,r4,0x0001
0014011c: 24a50001 addiu r5,r5,0x0001
00140120: 00b0102a slt r2,r5,r16				do for all abilities
00140124: 1440ffd8 bne r2,r0,0x 00140088
00140128: 24c60002 addiu r6,r6,0x0002

</Loop> If no abilites found?

0014012c: 1600000e bne r16,r0,0x 00140168		branch if abilities found
00140130: 34037000 ori r3,r0,0x7000

If no usable abilities found?

00140134: 3c028017 lui r2,0x8017
00140138: 8c423cb8 lw r2,0x3cb8(r2)				load menu data
0014013c: 34100001 ori r16,r0,0x0001
00140140: a44000e0 sh r0,0x00e0(r2)				store no menu type	
00140144: 3c028017 lui r2,0x8017
00140148: 8c424048 lw r2,0x4048(r2)				load skillset
0014014c: 00000000 nop
00140150: a4430000 sh r3,0x0000(r2)				store not-usable
00140154: a44000a4 sh r0,0x00a4(r2)				
00140158: a4400148 sh r0,0x0148(r2)
0014015c: 34020004 ori r2,r0,0x0004
00140160: 3c018015 lui r1,0x8015
00140164: a422d264 sh r2,-0x2d9c(r1)			store greyed out skillset?
00140168: 3c048017 lui r4,0x8017
0014016c: 8c843cb8 lw r4,0x3cb8(r4)				load menu
00140170: 34020030 ori r2,r0,0x0030
00140174: a48200be sh r2,0x00be(r4)				store 0xbe byte
00140178: 2a020007 slti r2,r16,0x0007			
0014017c: 14400009 bne r2,r0,0x 001401a4			set if abilities found < 7
00140180: 34020006 ori r2,r0,0x0006
00140184: 2602fffa addiu r2,r16,0xfffa			abilities - 6
00140188: 3c018016 lui r1,0x8016
0014018c: a4226996 sh r2,0x6996(r1)				store number of scrollable slots
00140190: 34020006 ori r2,r0,0x0006
00140194: 3c018016 lui r1,0x8016
00140198: a4226994 sh r2,0x6994(r1)				store 6 number of displayed slots
0014019c: 08050072 j 0x 001401c8
001401a0: 00000000 nop
001401a4: 00501023 subu r2,r2,r16
001401a8: 3c018016 lui r1,0x8016
001401ac: a4206996 sh r0,0x6996(r1)				store number of scrollable slots
001401b0: 3c018016 lui r1,0x8016
001401b4: a4306994 sh r16,0x6994(r1)			store number of abilities
001401b8: 948300be lhu r3,0x00be(r4)
001401bc: 000210c0 sll r2,r2,0x03				
001401c0: 00621821 addu r3,r3,r2
001401c4: a48300be sh r3,0x00be(r4)
001401c8: 3c028017 lui r2,0x8017
001401cc: 8c424038 lw r2,0x4038(r2)				load block #
001401d0: 34030001 ori r3,r0,0x0001
001401d4: 00021280 sll r2,r2,0x0a
001401d8: 3c018017 lui r1,0x8017
001401dc: 00220821 addu r1,r1,r2
001401e0: ac239870 sw r3,-0x6790(r1)			169870
001401e4: 3c018017 lui r1,0x8017
001401e8: 00220821 addu r1,r1,r2
001401ec: ac209874 sw r0,-0x678c(r1)			169874
001401f0: 3c018017 lui r1,0x8017
001401f4: 00220821 addu r1,r1,r2
001401f8: ac239878 sw r3,-0x6788(r1)			169878
001401fc: 8fbf0054 lw r31,0x0054(r29)
00140200: 8fb60050 lw r22,0x0050(r29)
00140204: 8fb5004c lw r21,0x004c(r29)
00140208: 8fb40048 lw r20,0x0048(r29)
0014020c: 8fb30044 lw r19,0x0044(r29)
00140210: 8fb20040 lw r18,0x0040(r29)
00140214: 8fb1003c lw r17,0x003c(r29)
00140218: 8fb00038 lw r16,0x0038(r29)
0014021c: 27bd0058 addiu r29,r29,0x0058
00140220: 03e00008 jr r31
00140224: 00000000 nop