Difference between revisions of "Main Skillset/ability loading"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
m
m
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
0013fa6c: 3c028017 lui r2,0x8017
+
Runs when a skillset is selected
0013fa70: 8c424048 lw r2,0x4048(r2) load Skillset ability List
 
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 skillset ability list + 0xa4 for MP cost
 
0013fab8: 3c018016 lui r1,0x8016
 
0013fabc: ac2269ac sw r2,0x69ac(r1) Store skillset ability list + 0x0148 for #turns
 
0013fac0: 0c04b7d0 jal 0x0012df40 get Attacker's data pointer
 
0013fac4: 0080a821 addu r21,r4,r0 r21 = PV (number of times gone through menus?)
 
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 action menu for action menu?
 
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 displayed 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 counter * 2
 
0013fb1c: 00831021 addu r2,r4,r3 r2 = Ability ID pointer
 
0013fb20: 00651821 addu r3,r3,r5 ability list + counter
 
0013fb24: a4490000 sh r9,0x0000(r2) store ability = 0xffff (0x00 - 0x100 Ability IDs)
 
0013fb28: a06801ec sb r8,0x01ec(r3) store 0xff into MP cost, Consumed Item ID (0x1ec - 0x26c)
 
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 (0x23e - 0x2be, there is a lot of overlap with some of these.)
 
0013fb40: 3c028017 lui r2,0x8017
 
0013fb44: 8c424048 lw r2,0x4048(r2) load ability list (this happens a lot)
 
0013fb48: 00000000 nop
 
0013fb4c: 00822021 addu r4,r4,r2 counter * 2 + ability pointer
 
0013fb50: 00451021 addu r2,r2,r5
 
0013fb54: a48000a4 sh r0,0x00a4(r4) clear "stock" "mp" (0xa4 - 0x1a4 Stock/MP)
 
0013fb58: a4890148 sh r9,0x0148(r4) store 0xffff (0x148 - 0x248)
 
0013fb5c: a0400290 sb r0,0x0290(r2) store 0x00 for silence/performance/reflect (0x290 - 0x310)
 
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) store 0x1 in # turns to complete (0x2e2 - 0x362)
 
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) store normal for ability display (0x8014d264 - 0x8014d300), no Unit ID (0x8014d304), and others
 
0013fb8c: 24a50001 addiu r5,r5,0x0001 counter + 1
 
0013fb90: 28a20050 slti r2,r5,0x0050
 
0013fb94: 1440ffde bne r2,r0,0x0013fb10 run 80 times
 
0013fb98: 24c60002 addiu r6,r6,0x0002 Ability display + 2
 
</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**
 
  
Default
+
  '''BATTLE.BIN''' - Main Skillset/ability loading
  0013fbe4: 16200014 bne r17,r0,0x0013fc38 branch if not default
+
  ---------------------------------------------------------------------------------------
  0013fbe8: a0430384 sb r3,0x0384(r2)
+
Parameter : r4 = 0x02 - 1st Menu (All Action menus and Math 1st set of skills)
0013fbec: 02402021 addu r4,r18,r0 r4 = attacker ID
+
                  0x01 - 2nd Menu for Math skills
0013fbf0: 3c068017 lui r6,0x8017
+
                  0x00 - Last Menu for math skill (spell list)
0013fbf4: 8cc64048 lw r6,0x4048(r6) Ability List
+
   
  0013fbf8: 02002821 addu r5,r16,r0 r5 = skillset
+
Returns : Nothing
  0013fbfc: afa00014 sw r0,0x0014(r29)
+
   
  0013fc00: 24c701ec addiu r7,r6,0x01ec Mp Cost
+
  This Routine will : Initialize Lists of Ability data used in menu
0013fc04: 24c2023e addiu r2,r6,0x023e Ability CT
+
                    Fill The lists (via other routines)
0013fc08: afa20010 sw r2,0x0010(r29) Parse Ability CT pointer through stack
+
                    Set Menu Size and Headers
0013fc0c: 24c20290 addiu r2,r6,0x0290 Silence/persevere/Reflect
+
                    Set Blinking red/grey abilities
0013fc10: afa20018 sw r2,0x0018(r29) silence/performance/reflect through stack
+
  ---------------------------------------------------------------------------------------
  0013fc14: 24c202e2 addiu r2,r6,0x02e2 Turns
+
0013fa6c: 3c028017 lui r2,0x8017            |
0013fc18: 0c0605f0 jal 0x001817c0 load ability data for skillset display (loads to 19f3c4 list)
+
0013fa70: 8c424048 lw r2,0x4048(r2)         |{{f/adr|Pointer to Ability List}}
0013fc1c: afa2001c sw r2,0x001c(r29) #turns to complete through stack
+
  0013fa74: 27bdffa8 addiu r29,r29,-0x0058    |
0013fc20: 3c058017 lui r5,0x8017
+
  0013fa78: afb20040 sw r18,0x0040(r29)      |
0013fc24: 8ca54048 lw r5,0x4048(r5)
+
  0013fa7c: 3c128015 lui r18,0x8015          |
  0013fc28: 34060050 ori r6,r0,0x0050 r6 = 0x50
+
  0013fa80: 8652d08a lh r18,-0x2f76(r18)      |{{f/load|load attacker battle ID}} {{f/std|8014d084 - Selected Unit ID}}
  0013fc2c: 24a40334 addiu r4,r5,0x0334 Now/Turn display
+
  0013fa84: afb5004c sw r21,0x004c(r29)      |
  0013fc30: 0c052fd5 jal 0x0014bf54 store r5 into r4
+
  0013fa88: afbf0054 sw r31,0x0054(r29)      |
  0013fc34: 24a5023e addiu r5,r5,0x023e
+
  0013fa8c: afb60050 sw r22,0x0050(r29)      |
 
+
  0013fa90: afb40048 sw r20,0x0048(r29)      |
Item Inventory
+
  0013fa94: afb30044 sw r19,0x0044(r29)      |
  0013fc38: 34140001 ori r20,r0,0x0001
+
  0013fa98: afb1003c sw r17,0x003c(r29)       |
  0013fc3c: 16340007 bne r17,r20,0x0013fc5c branch if not item
+
  0013fa9c: afb00038 sw r16,0x0038(r29)      |
  0013fc40: 34130002 ori r19,r0,0x0002
+
  0013faa0: 244300a4 addiu r3,r2,0x00a4      |{{f/adr|Pointer to output list "Stock" "Mp" }}
  0013fc44: 02402021 addu r4,r18,r0 r4 = unit ID
+
  0013faa4: 3c018016 lui r1,0x8016            |
  0013fc48: 3c068017 lui r6,0x8017
+
0013faa8: ac2269a4 sw r2,0x69a4(r1)         |{{f/store|store skillset ability list pointer}}
  0013fc4c: 8cc64048 lw r6,0x4048(r6)
+
  0013faac: 24420148 addiu r2,r2,0x0148      |{{f/adr|Pointer to output list "Turns" }}
  0013fc50: 02002821 addu r5,r16,r0
+
  0013fab0: 3c018016 lui r1,0x8016            |
  0013fc54: 0c0606dc jal 0x00181b70 [[Item Ability Loading]]
+
  0013fab4: ac2369a8 sw r3,0x69a8(r1)        |{{f/store|store skillset ability list + 0xa4 for MP cost}}
  0013fc58: 24c601ec addiu r6,r6,0x01ec Item Used List per Ability ID (don't parse other arguments through stack)
+
  0013fab8: 3c018016 lui r1,0x8016            |
 
+
  0013fabc: ac2269ac sw r2,0x69ac(r1)         |{{f/store|Store skillset ability list + 0x0148 for #turns}}
Weapon Inventory
+
  0013fac0: 0c04b7d0 jal 0x0012df40          |{{f/jal|0012df40_-_0012df64|0012df40_-_0012df64}} {{f/std|Returns Selected unit battle pointer}}
  0013fc5c: 16330008 bne r17,r19,0x0013fc80 branch if not throw
+
  0013fac4: 0080a821 addu r21,r4,r0          |{{f/std|<nowiki>r21 = PV (number of times gone through menus?)</nowiki>}}
  0013fc60: 34020003 ori r2,r0,0x0003
+
  0013fac8: 0040b021 addu r22,r2,r0           |{{f/adr|Pointer to Unit Battle stats}}
  0013fc64: 02402021 addu r4,r18,r0
+
  0013facc: 00002821 addu r5,r0,r0            |{{f/std|Initialize counter}}
  0013fc68: 3c068017 lui r6,0x8017
+
  0013fad0: 3409ffff ori r9,r0,0xffff        |
  0013fc6c: 8cc64048 lw r6,0x4048(r6)
+
  0013fad4: 3c028017 lui r2,0x8017           |
0013fc70: 02002821 addu r5,r16,r0 skillset
+
  0013fad8: 8c423cb8 lw r2,0x3cb8(r2)         |{{f/adr|Pointer to menu data}} {{f/std|0x80166b10}}
  0013fc74: 0c06072e jal 0x00181cb8 [[Throw Ability & Item Loading]]
+
0013fadc: 340800ff ori r8,r0,0x00ff        |
  0013fc78: 24c601ec addiu r6,r6,0x01ec Item Used list per Item ID
+
  0013fae0: 84420128 lh r2,0x0128(r2)        |{{f/load|Used Skillset (1 for Primary 2 For Secondary)}}
  0013fc7c: 34020003 ori r2,r0,0x0003 math skill check
+
  0013fae4: 34070001 ori r7,r0,0x0001        |
 
+
  0013fae8: 3c018017 lui r1,0x8017            |
Math Skill
+
  0013faec: 00220821 addu r1,r1,r2            |
r21 = which menu to load
+
0013faf0: 9031404c lbu r17,0x404c(r1)      |{{f/load|Load action menu ID}} {{f/std| (based on used skillset)}}
0x02 - first set of parameters
+
  0013faf4: 3c018017 lui r1,0x8017           |
0x01 - second set of parameters
+
  0013faf8: 00220821 addu r1,r1,r2            |
0x00 - abilities
+
0013fafc: 90304060 lbu r16,0x4060(r1)      |{{f/load|Load displayed skillset ID}} {{f/std| (based on used skillset)}}
  0013fc80: 16220014 bne r17,r2,0x 0013fcd4 branch if not math skill
+
  0013fb00: 3c068015 lui r6,0x8015            |
  0013fc84: 00000000 nop
+
  0013fb04: 24c6d264 addiu r6,r6,-0x2d9c      |{{f/std|8014d264}}
0013fc88: 16b30005 bne r21,r19,0x 0013fca0 branch if not loading first set of parameters
+
  0013fb08: 3c018017 lui r1,0x8017            |
  0013fc8c: 02402021 addu r4,r18,r0 r4 = attacker ID
+
  0013fb0c: a030982d sb r16,-0x67d3(r1)      |{{f/store|store skillset at 0x8016982d}}
0013fc90: 3c068017 lui r6,0x8017
+
                                            {{f/bloop|LOOP - Initialize Abillity lists}}
  0013fc94: 8cc64048 lw r6,0x4048(r6) primary menu ability list
+
  0013fb10: 3c038017 lui r3,0x8017               |{{f/std|}}
  0013fc98: 0c0607bc jal 0x00181ef0 [[Math Skill Ability Display]] Checks for primary menu
+
  0013fb14: 8c634048 lw r3,0x4048(r3)             |{{f/adr|Pointer to Ability List}}
  0013fc9c: 02002821 addu r5,r16,r0 r5 = skillset
+
  0013fb18: 00052040 sll r4,r5,0x01              |{{f/std|counter * 2}}
  0013fca0: 16b40005 bne r21,r20,0x 0013fcb8 branch if not loading second set of parameters
+
  0013fb1c: 00831021 addu r2,r4,r3                |{{f/adr|Dynamic Pointer to Ability List (Halfword offset)}}
  0013fca4: 02402021 addu r4,r18,r0
+
  0013fb20: 00651821 addu r3,r3,r5                |{{f/adr|Dynamic Pointer to Ability List (Byte offset)}}
  0013fca8: 3c068017 lui r6,0x8017
+
  0013fb24: a4490000 sh r9,0x0000(r2)            |{{f/store|Initialize Ability ID List (0xffff from 0x00 to 0x100)}}
  0013fcac: 8cc64048 lw r6,0x4048(r6) Secondary menu ability list
+
  0013fb28: a06801ec sb r8,0x01ec(r3)            |{{f/store|Initialize MP cost, Consumed Item ID  with 0xff}} {{f/std|(0x1ec - 0x26c) }}
  0013fcb0: 0c0607c5 jal 0x00181f14 [[Math Skill Ability Display]] Checks for secondary menu
+
  0013fb2c: 3c028017 lui r2,0x8017                |
  0013fcb4: 02002821 addu r5,r16,r0
+
  0013fb30: 8c424048 lw r2,0x4048(r2)            |{{f/adr|Pointer to Ability List}}
  0013fcb8: 16a00007 bne r21,r0,0x 0013fcd8 branch if not loading abilities
+
  0013fb34: 00000000 nop                          |
  0013fcbc: 34020006 ori r2,r0,0x0006
+
  0013fb38: 00451021 addu r2,r2,r5                |{{f/adr|Dynamic Pointer to Ability List (Byte offset)}}
  0013fcc0: 02402021 addu r4,r18,r0
+
  0013fb3c: a047023e sb r7,0x023e(r2)            |{{f/store|Intialize CT list with 0x01 in ability CT }} {{f/std|(0x23e - 0x2be, there is a lot of overlap with some of these.)}}
0013fcc4: 3c068017 lui r6,0x8017
+
  0013fb40: 3c028017 lui r2,0x8017                |
  0013fcc8: 8cc64048 lw r6,0x4048(r6) Spell ability List
+
  0013fb44: 8c424048 lw r2,0x4048(r2)             |{{f/adr|Pointer to Ability List}}
  0013fccc: 0c06081a jal 0x00182068 [[Math Skill ability loading]]
+
  0013fb48: 00000000 nop                          |
  0013fcd0: 02002821 addu r5,r16,r0
+
  0013fb4c: 00822021 addu r4,r4,r2               |{{f/adr|Dynamic Pointer to Ability List (Halfword offset)}}
 
+
  0013fb50: 00451021 addu r2,r2,r5                |
Monster & frog
+
  0013fb54: a48000a4 sh r0,0x00a4(r4)            |{{f/store|clear "stock" "mp" (0xa4 - 0x1a4 Stock/MP)}}
  0013fcd4: 34020006 ori r2,r0,0x0006
+
  0013fb58: a4890148 sh r9,0x0148(r4)            |{{f/store|store 0xffff (0x148 - 0x248)}}
  0013fcd8: 1622000a bne r17,r2,0x 0013fd04 branch if not monster menu
+
  0013fb5c: a0400290 sb r0,0x0290(r2)            |{{f/store|store 0x00 for silence/performance/reflect (0x290 - 0x310)}}
  0013fcdc: 34020007 ori r2,r0,0x0007
+
  0013fb60: 3c028017 lui r2,0x8017                |
  0013fce0: 02402021 addu r4,r18,r0
+
  0013fb64: 8c424048 lw r2,0x4048(r2)            |{{f/adr|Pointer to Ability List}}
  0013fce4: 02002821 addu r5,r16,r0
+
  0013fb68: 00000000 nop                          |
  0013fce8: 3c068017 lui r6,0x8017
+
  0013fb6c: 00451021 addu r2,r2,r5                |{{f/adr|Dynamic Pointer to Ability List (Byte offset)}}
  0013fcec: 8cc64048 lw r6,0x4048(r6) Ability ID list
+
  0013fb70: a04702e2 sb r7,0x02e2(r2)            |{{f/store|store 0x1 in # turns to complete (0x2e2 - 0x362)}}
  0013fcf0: 00003821 addu r7,r0,r0 r7 = 0
+
  0013fb74: 3c028017 lui r2,0x8017               |
  0013fcf4: 24c20290 addiu r2,r6,0x0290
+
  0013fb78: 8c424048 lw r2,0x4048(r2)             |{{f/adr|Pointer to Ability List}} {{f/std|...and again}}
  0013fcf8: 0c0608b3 jal 0x001822cc monster skill/frog attack ability loading
+
0013fb7c: 00000000 nop                          |
0013fcfc: afa20010 sw r2,0x0010(r29) parse silence/reflectable/performance
+
  0013fb80: 00451021 addu r2,r2,r5                |{{f/adr|Dynamic Pointer to Ability List (Byte offset)}}
  0013fd00: 34020007 ori r2,r0,0x0007
+
  0013fb84: a0480334 sb r8,0x0334(r2)            |{{f/store|<nowiki>store CT list = 0xFF</nowiki>}}
 
+
  0013fb88: a4c00000 sh r0,0x0000(r6)            |{{f/store|store normal for ability display (0x8014d264 - 0x8014d300), no Unit ID (0x8014d304), and others}} {{f/std|From 0x8014d264 to 0x8014d364}}
Katana Inventory
+
  0013fb8c: 24a50001 addiu r5,r5,0x0001          |{{f/std|Counter + 1}}
  0013fd04: 16220008 bne r17,r2,0x0013fd28 branch if not draw out
+
  0013fb90: 28a20050 slti r2,r5,0x0050            |{{f/std|Check limit}}
  0013fd08: 3402000a ori r2,r0,0x000a
+
  0013fb94: 1440ffde bne r2,r0,0x0013fb10    {{f/eloop|Loop 80 times}}
  0013fd0c: 02402021 addu r4,r18,r0
+
  0013fb98: 24c60002 addiu r6,r6,0x0002          |{{f/adr|Dynamic pointer to Ability display + 2}}
  0013fd10: 3c068017 lui r6,0x8017
+
                                            {{f/sec|Set end of lists}}
  0013fd14: 8cc64048 lw r6,0x4048(r6) parse ability List
+
  0013fb9c: 3c028017 lui r2,0x8017            |{{f/std|}}
  0013fd18: 02002821 addu r5,r16,r0
+
  0013fba0: 8c424048 lw r2,0x4048(r2)        |{{f/adr|Pointer to Ability List}}
  0013fd1c: 0c060999 jal 0x00182664 [[Draw Out]]
+
  0013fba4: 340300ff ori r3,r0,0x00ff        |
  0013fd20: 24c601ec addiu r6,r6,0x01ec consumed Items list by ability ID
+
  0013fba8: a043023c sb r3,0x023c(r2)        |{{f/store|End MP/Stock List}} {{f/std| it is already 0xff…}}
  0013fd24: 3402000a ori r2,r0,0x000a
+
  0013fbac: 3c028017 lui r2,0x8017            |
 
+
0013fbb0: 8c424048 lw r2,0x4048(r2)         |{{f/adr|Pointer to Ability List}}
Charge
+
  0013fbb4: 00000000 nop                      |
  0013fd28: 16220010 bne r17,r2,0x 0013fd6c
+
0013fbb8: a043028e sb r3,0x028e(r2)        |{{f/store|End CT List}} {{f/std| it is already 0xff…}}
  0013fd2c: 34020003 ori r2,r0,0x0003
+
  0013fbbc: 3c028017 lui r2,0x8017            |
0013fd30: 02402021 addu r4,r18,r0
+
  0013fbc0: 8c424048 lw r2,0x4048(r2)         |{{f/adr|Pointer to Ability List}}
0013fd34: 3c068017 lui r6,0x8017
+
  0013fbc4: 00000000 nop                      |
  0013fd38: 8cc64048 lw r6,0x4048(r6) Ability ID list
+
  0013fbc8: a04302e0 sb r3,0x02e0(r2)         |{{f/store|End Silence Reflect Perform list}}
  0013fd3c: 02002821 addu r5,r16,r0
+
  0013fbcc: 3c028017 lui r2,0x8017            |
  0013fd40: 24c701ec addiu r7,r6,0x01ec Raw Ability CT
+
  0013fbd0: 8c424048 lw r2,0x4048(r2)        |{{f/adr|Pointer to Ability List}}
  0013fd44: 24c202e2 addiu r2,r6,0x02e2 Turns
+
0013fbd4: 00000000 nop                      |
0013fd48: 0c0609ed jal 0x001827b4 [[Charge Skillset Loading]]
+
  0013fbd8: a0430332 sb r3,0x0332(r2)         |{{f/store|End Turn list}}
0013fd4c: afa20010 sw r2,0x0010(r29) # turns in stack + 0x10
+
  0013fbdc: 3c028017 lui r2,0x8017            |
  0013fd50: 3c058017 lui r5,0x8017
+
  0013fbe0: 8c424048 lw r2,0x4048(r2)         |{{f/adr|Pointer to Ability List}}
  0013fd54: 8ca54048 lw r5,0x4048(r5) Ability ID list
+
   
  0013fd58: 34060050 ori r6,r0,0x0050 r6 = 0x80
+
  '''**Section 1 - Load ability-relevant data**'''
  0013fd5c: 24a40334 addiu r4,r5,0x0334 Ability CT?
+
                                        {{f/sec|------- Action Menu 0x00 - Default -----------}}
  0013fd60: 0c052fd5 jal 0x0014bf54 store raw ability CT into raw ability CT duplicate?
+
  0013fbe4: 16200014 bne r17,r0,0x0013fc38    {{f/Cond|<nowiki>If Action Menu = 0x00</nowiki>}}
  0013fd64: 24a501ec addiu r5,r5,0x01ec Raw ability CT
+
  0013fbe8: a0430384 sb r3,0x0384(r2)            |{{f/std|}}
  0013fd68: 34020003 ori r2,r0,0x0003
+
  0013fbec: 02402021 addu r4,r18,r0              |{{f/std|<nowiki>r4 = attacker ID</nowiki>}}
 
+
  0013fbf0: 3c068017 lui r6,0x8017                |
All
+
0013fbf4: 8cc64048 lw r6,0x4048(r6)             |{{f/adr|Pointer to Ability List}}
  0013fd6c: 12220002 beq r17,r2,0x 0013fd78 branch if Math skill
+
0013fbf8: 02002821 addu r5,r16,r0              |{{f/std|<nowiki>r5 = skillset ID</nowiki>}}
  0013fd70: 341200ac ori r18,r0,0x00ac default r18 to 0xac (menu type flags?)
+
0013fbfc: afa00014 sw r0,0x0014(r29)            |
  0013fd74: 0000a821 addu r21,r0,r0 r21 = 0 if not math skill
+
0013fc00: 24c701ec addiu r7,r6,0x01ec          |{{f/adr|Pointer to MP Cost/ Stock List}}
0013fd78: 34020003 ori r2,r0,0x0003
+
0013fc04: 24c2023e addiu r2,r6,0x023e          |{{f/adr|Pointer to Ability CT}}
  0013fd7c: 3c018016 lui r1,0x8016
+
  0013fc08: afa20010 sw r2,0x0010(r29)            |{{f/store|Send Ability CT pointer through stack}}
  0013fd80: a42269a0 sh r2,0x69a0(r1) store stock/mp/turns display (initialised)
+
  0013fc0c: 24c20290 addiu r2,r6,0x0290          |{{f/adr| Pointer to Silence/persevere/Reflect}}
  0013fd84: 3c018016 lui r1,0x8016
+
  0013fc10: afa20018 sw r2,0x0018(r29)           |{{f/store|Send silence/performance/reflect pointer  through stack}}
  0013fd88: a42269a2 sh r2,0x69a2(r1) store stock/mp/turns display (initialised)
+
  0013fc14: 24c202e2 addiu r2,r6,0x02e2          |{{f/adr| Pointer to Nb of Turns List}}
  0013fd8c: 3402006a ori r2,r0,0x006a
+
  0013fc18: 0c0605f0 jal 0x001817c0              |{{f/jal|Load_ability_data_for_skillset|Load_ability_data_for_skillset}} {{f/std|Fill List and returns Nb of usable Abilities (known - sword - materia - frog)}}
  0013fd90: 3c018016 lui r1,0x8016
+
  0013fc1c: afa2001c sw r2,0x001c(r29)            |{{f/store|Send Nb of Turns pointer through stack}}
  0013fd94: a422699a sh r2,0x699a(r1) store MP display X offset
+
  0013fc20: 3c058017 lui r5,0x8017               |
  0013fd98: 3402007e ori r2,r0,0x007e
+
  0013fc24: 8ca54048 lw r5,0x4048(r5)             |{{f/adr|Pointer to Ability List}}
  0013fd9c: 3c018016 lui r1,0x8016
+
  0013fc28: 34060050 ori r6,r0,0x0050            |{{f/std|Size of data to transfer 0x50}}
0013fda0: a422699c sh r2,0x699c(r1) store turn display X offset
+
  0013fc2c: 24a40334 addiu r4,r5,0x0334          |{{f/adr| Pointer to Ability CT}}
  0013fda4: 00111080 sll r2,r17,0x02 action menu byte * 4
+
  0013fc30: 0c052fd5 jal 0x0014bf54              |{{f/jal|0014bf54_-_0014bf78|Copy 0x50 Bytes from r5 to r4}}
  0013fda8: 3c018016 lui r1,0x8016
+
  0013fc34: 24a5023e addiu r5,r5,0x023e          |{{f/adr|Pointer to Ability CT}}
  0013fdac: a420699e sh r0,0x699e(r1) store Ability name display
+
   
  0013fdb0: 3c018017 lui r1,0x8017
+
                                        {{f/sec|------- Action Menu 0x01 - Item inventory -----------}}
  0013fdb4: 00220821 addu r1,r1,r2
+
  0013fc38: 34140001 ori r20,r0,0x0001        |{{f/std|}}
  0013fdb8: 84239266 lh r3,-0x6d9a(r1) 80169266 + Action menu byte*4 (if action menu calls inventory or not?)
+
  0013fc3c: 16340007 bne r17,r20,0x0013fc5c  {{f/Cond|<nowiki>If Action Menu = 0x01</nowiki>}}
 
+
  0013fc40: 34130002 ori r19,r0,0x0002            |{{f/std|}}
Default - 0x0000
+
  0013fc44: 02402021 addu r4,r18,r0              |{{f/std|<nowiki>r4 = unit ID</nowiki>}}
Item Inventory - 0001
+
  0013fc48: 3c068017 lui r6,0x8017               |
Throw - 0001
+
  0013fc4c: 8cc64048 lw r6,0x4048(r6)             |{{f/adr|Pointer to Ability List}}
Math Skill - 0000
+
  0013fc50: 02002821 addu r5,r16,r0              |
Elemental - 0000
+
  0013fc54: 0c0606dc jal 0x00181b70              |{{f/jal|Item_Ability_Loading|Item_Ability_Loading}}
Blank - 0000
+
  0013fc58: 24c601ec addiu r6,r6,0x01ec          |{{f/std|Item Used List per Ability ID (don't parse other arguments through stack)}}
Monster - 0000
+
   
Katana - 0001
+
                                        {{f/sec|------- Action Menu0x02 - Weapon inventory -----------}}
Attack - 0000
+
  0013fc5c: 16330008 bne r17,r19,0x0013fc80  {{f/Cond|<nowiki>If Action Menu = 0x02</nowiki>}}
Jump - 0000
+
  0013fc60: 34020003 ori r2,r0,0x0003            |{{f/std|}}
Charge - 0000
+
  0013fc64: 02402021 addu r4,r18,r0               |{{f/std|<nowiki>r4 = unit ID</nowiki>}}
Defend - 0000
+
  0013fc68: 3c068017 lui r6,0x8017                |
Equip Change - 0000
+
  0013fc6c: 8cc64048 lw r6,0x4048(r6)            |{{f/adr|Pointer to Ability List}}
Unknown - 0000
+
  0013fc70: 02002821 addu r5,r16,r0              |{{f/std|skillset}}
Blank - 0000
+
  0013fc74: 0c06072e jal 0x00181cb8              |{{f/jal|Throw_Ability_%26_Item_Loading|Throw Ability & Item Loading}}
Unknown - 0000
+
  0013fc78: 24c601ec addiu r6,r6,0x01ec          |{{f/std|Item Used list per Item ID}}
 
+
  0013fc7c: 34020003 ori r2,r0,0x0003            |{{f/std|math skill check}}
**2nd Section - **  Set Usabilities
+
   
 
+
                                        {{f/sec|------- Action Menu 0x03 - Mathematics  -----------}}
0013fdbc: 34020001 ori r2,r0,0x0001
+
  0013fc80: 16220014 bne r17,r2,0x0013fcd4    {{f/Cond|<nowiki>If Action Menu = 0x03</nowiki>}}
  0013fdc0: 14620048 bne r3,r2,0x 0013fee4 branch if skillset doesn't call inventory (item/draw out/throw)
+
  0013fc84: 00000000 nop                          |{{f/std|}}
  0013fdc4: 00003021 addu r6,r0,r0
+
  0013fc88: 16b30005 bne r21,r19,0x0013fca0      {{f/Cond|<nowiki>If PV = 0x02 : Load 1st set of Math abilities</nowiki>}}
Item/Throw/Draw Out - Set usability based on item quantity
+
  0013fc8c: 02402021 addu r4,r18,r0                  |{{f/std|<nowiki>r4 = attacker ID</nowiki>}}
  0013fdc8: 3c048017 lui r4,0x8017
+
  0013fc90: 3c068017 lui r6,0x8017                    |
0013fdcc: 8c844048 lw r4,0x4048(r4) load ability list address
+
  0013fc94: 8cc64048 lw r6,0x4048(r6)                 |{{f/adr|Pointer to Ability List}}
  0013fdd0: 0c04fe80 jal 0x 0013fa00 Store used items into ability list
+
  0013fc98: 0c0607bc jal 0x00181ef0                  |{{f/jal|Math_Skill_Ability_Display|Math_Skill_Ability_Display}} {{f/std|Checks for primary menu}}
  0013fdd4: 248501ec addiu r5,r4,0x01ec Item Used
+
  0013fc9c: 02002821 addu r5,r16,r0                  |{{f/std|<nowiki>r5 = skillset ID</nowiki>}}
  0013fdd8: 00408021 addu r16,r2,r0 r16 = # of abilities
+
  0013fca0: 16b40005 bne r21,r20,0x0013fcb8      {{f/Cond|<nowiki>if PV = 0x01 : Load 2nd set of Math abilities</nowiki>}}
  0013fddc: 3c058017 lui r5,0x8017
+
  0013fca4: 02402021 addu r4,r18,r0                  |{{f/std|<nowiki>r4 = attacker ID</nowiki>}}
  0013fde0: 8ca54048 lw r5,0x4048(r5) load skillset data
+
  0013fca8: 3c068017 lui r6,0x8017                    |
  0013fde4: 02003021 addu r6,r16,r0 # of abilities
+
0013fcac: 8cc64048 lw r6,0x4048(r6)                 |{{f/adr|Pointer to Ability List}}
  0013fde8: 24a40148 addiu r4,r5,0x0148 r4 = Turns
+
0013fcb0: 0c0607c5 jal 0x00181f14                  |{{f/jal|Math_Skill_Ability_Display|Math_Skill_Ability_Display}} {{f/std|Checks for secondary menu}}
  0013fdec: 0c04fe8e jal 0x 0013fa38 do for each r6, load from r5, store in r4 **Set Turns**
+
  0013fcb4: 02002821 addu r5,r16,r0                  |{{f/std|Skillset ID}}
  0013fdf0: 24a502e2 addiu r5,r5,0x02e2 r5 = turns
+
  0013fcb8: 16a00007 bne r21,r0,0x0013fcd8        {{f/Cond|<nowiki>if PV = 0x00 : Load Math spell list</nowiki>}}
  0013fdf4: 00003021 addu r6,r0,r0
+
  0013fcbc: 34020006 ori r2,r0,0x0006                |{{f/std|}}
0013fdf8: 1a000019 blez r16,0x 0013fe60 branch if no abilities found
+
  0013fcc0: 02402021 addu r4,r18,r0                  |{{f/std|<nowiki>r4 = attacker ID</nowiki>}}
  0013fdfc: 00002821 addu r5,r0,r0
+
  0013fcc4: 3c068017 lui r6,0x8017                    |
  0013fe00: 34070004 ori r7,r0,0x0004
+
  0013fcc8: 8cc64048 lw r6,0x4048(r6)                |{{f/adr|Pointer to Ability List}}
  0013fe04: 3c048015 lui r4,0x8015
+
  0013fccc: 0c06081a jal 0x00182068                  |{{f/jal|Math_Skill_ability_loading|Math_Skill_ability_loading}} {{f/std|Loop through Valid skillset and seek known Spells}}
  0013fe08: 2484d264 addiu r4,r4,0xd264 load availability Data
+
  0013fcd0: 02002821 addu r5,r16,r0                  |{{f/std|Skillset ID}}
  0013fe0c: 3c038017 lui r3,0x8017
+
   
  0013fe10: 8c634048 lw r3,0x4048(r3) load Ability ID list
+
                                        {{f/sec|------- Action Menu 0x06 Monsters / Frog -----------}}
<Loop> Grey Out item abilities>
+
  0013fcd4: 34020006 ori r2,r0,0x0006        |{{f/std|}}
  0013fe14: 00000000 nop
+
  0013fcd8: 1622000a bne r17,r2,0x0013fd04    {{f/Cond|<nowiki>If Action Menu = 0x06</nowiki>}}
  0013fe18: 94620000 lhu r2,0x0000(r3) load ability
+
  0013fcdc: 34020007 ori r2,r0,0x0007            |
  0013fe1c: 3c018006 lui r1,0x8006
+
  0013fce0: 02402021 addu r4,r18,r0              |{{f/std|Unit ID}}
  0013fe20: 00220821 addu r1,r1,r2
+
  0013fce4: 02002821 addu r5,r16,r0               |{{f/std|Skillset ID}}
0013fe24: 902296e0 lbu r2,-0x6920(r1) load item quantity
+
  0013fce8: 3c068017 lui r6,0x8017                |
  0013fe28: 00000000 nop
+
  0013fcec: 8cc64048 lw r6,0x4048(r6)            |{{f/adr|Pointer to Ability List}}
0013fe2c: a46200a4 sh r2,0x00a4(r3) store item quantity
+
  0013fcf0: 00003821 addu r7,r0,r0               |{{f/std|<nowiki>r7 = 0</nowiki>}}
  0013fe30: 946200a4 lhu r2,0x00a4(r3) load item quantity
+
  0013fcf4: 24c20290 addiu r2,r6,0x0290          |{{f/adr| Pointer to Silence/persevere/Reflect}}
  0013fe34: 00000000 nop
+
  0013fcf8: 0c0608b3 jal 0x001822cc              |{{f/jal|Monster_skill,_frog_attack_ability_loading|Monster_skill,_frog_attack_ability_loading}}
0013fe38: 14400003 bne r2,r0,0x0013fe48 branch if not 0
+
  0013fcfc: afa20010 sw r2,0x0010(r29)           |{{f/store|send silence/reflectable/performance pointer through stack}}
  0013fe3c: 00000000 nop
+
  0013fd00: 34020007 ori r2,r0,0x0007            |
  0013fe40: 0804ff93 j 0x 0013fe4c
+
   
  0013fe44: a4870000 sh r7,0x0000(r4) store grayed out ability
+
                                        {{f/sec|------- Action Menu 0x07 Katana Inventory -----------}}
if item quantity != 0
+
  0013fd04: 16220008 bne r17,r2,0x0013fd28    {{f/Cond|<nowiki>If Action Menu = 0x07</nowiki>}}
  0013fe48: 34060001 ori r6,r0,0x0001 set ability usable?
+
  0013fd08: 3402000a ori r2,r0,0x000a            |
  0013fe4c: 24840002 addiu r4,r4,0x0002 count another availability if item is usable
+
  0013fd0c: 02402021 addu r4,r18,r0              |{{f/std|Unit ID}}
  0013fe50: 24a50001 addiu r5,r5,0x0001 counter + 1
+
  0013fd10: 3c068017 lui r6,0x8017                |
  0013fe54: 00b0102a slt r2,r5,r16
+
  0013fd14: 8cc64048 lw r6,0x4048(r6)            |{{f/adr|Pointer to Ability List}}
0013fe58: 1440ffee bne r2,r0,0x 0013fe14 do for all Items in list
+
  0013fd18: 02002821 addu r5,r16,r0              |{{f/std|Skillset ID}}
  0013fe5c: 24630002 addiu r3,r3,0x0002 next ability ID
+
0013fd1c: 0c060999 jal 0x00182664              |{{f/jal|Draw_Out|Draw_Out}}
</loop>
+
  0013fd20: 24c601ec addiu r6,r6,0x01ec          |{{f/adr|Pointer to MP Cost/ Stock List}}
 
+
  0013fd24: 3402000a ori r2,r0,0x000a            |
  0013fe60: 10c00003 beq r6,r0,0x 0013fe70 branch if have no consumable items
+
   
  0013fe64: 34070007 ori r7,r0,0x0007
+
                                        {{f/sec|------- Action Menu 0x0A - Aim -----------}}
  0013fe68: 0804ffa7 j 0x 0013fe9c
+
  0013fd28: 16220010 bne r17,r2,0x0013fd6c    {{f/Cond|<nowiki>If Action Menu = 0x0A</nowiki>}}
0013fe6c: 2652fffc addiu r18,r18,0xfffc if items are available, r18 = 0xa8
+
  0013fd2c: 34020003 ori r2,r0,0x0003            |
 
+
0013fd30: 02402021 addu r4,r18,r0              |{{f/std|Unit ID}}
if no items with quantity > 0 found
+
0013fd34: 3c068017 lui r6,0x8017               |
  0013fe70: 02003021 addu r6,r16,r0
+
  0013fd38: 8cc64048 lw r6,0x4048(r6)             |{{f/adr|Pointer to Ability List}}
  0013fe74: 34120094 ori r18,r0,0x0094 if no items can be found, r18 = 0x94
+
  0013fd3c: 02002821 addu r5,r16,r0              |
0013fe78: 3c058017 lui r5,0x8017
+
  0013fd40: 24c701ec addiu r7,r6,0x01ec           |{{f/std|Raw Ability CT}} {{f/std|Use MP list to store charge CT ?}}
0013fe7c: 8ca54048 lw r5,0x4048(r5) r5 = skillset abilities
+
  0013fd44: 24c202e2 addiu r2,r6,0x02e2          |{{f/std|Turns}}
  0013fe80: 34020002 ori r2,r0,0x0002
+
  0013fd48: 0c0609ed jal 0x001827b4              |{{f/jal|Charge_Skillset_Loading|Charge_Skillset_Loading}}
  0013fe84: 3c018016 lui r1,0x8016
+
  0013fd4c: afa20010 sw r2,0x0010(r29)            {{f/Cond| turns in stack + 0x10}}
  0013fe88: a42269a2 sh r2,0x69a2(r1) Remove "stock" display numbers
+
  0013fd50: 3c058017 lui r5,0x8017                |
  0013fe8c: 24a400a4 addiu r4,r5,0x00a4 r4 = item quantities
+
  0013fd54: 8ca54048 lw r5,0x4048(r5)            |{{f/adr|Ability ID list}}
  0013fe90: 0c04fe8e jal 0x 0013fa38 set turns = 1 (now)?
+
  0013fd58: 34060050 ori r6,r0,0x0050            |{{f/std|<nowiki>r6 = 0x80</nowiki>}}
  0013fe94: 24a502e2 addiu r5,r5,0x02e2 r5 = 01 data
+
0013fd5c: 24a40334 addiu r4,r5,0x0334          |{{f/std|Ability CT?}}
  0013fe98: 34070008 ori r7,r0,0x0008
+
  0013fd60: 0c052fd5 jal 0x0014bf54              |{{f/jal|0014bf54_-_0014bf78|Copy 0x50 Bytes from r5 to r4}}
 
+
  0013fd64: 24a501ec addiu r5,r5,0x01ec          |{{f/std|Raw ability CT}}
Items
+
  0013fd68: 34020003 ori r2,r0,0x0003            |
  0013fe9c: 34093800 ori r9,r0,0x3800 Store Item display
+
   
  0013fea0: 3c048016 lui r4,0x8016
+
  '''**2nd Section -  Set Usabilities / Menu data **'''
0013fea4: 2484699a addiu r4,r4,0x699a 8016699a
+
                                        {{f/sec|------ POST ACTION MENU MAIN SECTION ----}}
  0013fea8: 94820000 lhu r2,0x0000(r4) load Stock numbers display location
+
  0013fd6c: 12220002 beq r17,r2,0x0013fd78    {{f/Cond|If Action Menu is not Mathematics}}
  0013feac: 3c038016 lui r3,0x8016
+
  0013fd70: 341200ac ori r18,r0,0x00ac        |{{f/std|default r18 to 0xac (menu type flags?)}}
  0013feb0: 9463699c lhu r3,0x699c(r3) load Turns display location
+
  0013fd74: 0000a821 addu r21,r0,r0              |{{f/std|<nowiki>r21 = 0 if not math skill (Last Math skill menu has already r21 to 0x00)</nowiki>}}
  0013feb4: 2442fffc addiu r2,r2,0xfffc move left by 4
+
  0013fd78: 34020003 ori r2,r0,0x0003        |{{f/std|}}
  0013feb8: 2463fffc addiu r3,r3,0xfffc move left by 4
+
  0013fd7c: 3c018016 lui r1,0x8016            |
  0013febc: a4820000 sh r2,0x0000(r4) store new location
+
  0013fd80: a42269a0 sh r2,0x69a0(r1)        |{{f/store|store stock/mp/turns display (initialised)}}
  0013fec0: 34020007 ori r2,r0,0x0007
+
  0013fd84: 3c018016 lui r1,0x8016            |
  0013fec4: 3c018016 lui r1,0x8016
+
  0013fd88: a42269a2 sh r2,0x69a2(r1)        |{{f/store|store stock/mp/turns display (initialised)}}
0013fec8: a423699c sh r3,0x699c(r1) store new location
+
  0013fd8c: 3402006a ori r2,r0,0x006a        |
0013fecc: 1622005e bne r17,r2,0x 00140048 branch if not Draw out
+
  0013fd90: 3c018016 lui r1,0x8016            |
  0013fed0: 34060011 ori r6,r0,0x0011 Item/Throw
+
0013fd94: a422699a sh r2,0x699a(r1)        |{{f/store|store MP display X offset}}
  0013fed4: 08050012 j 0x 00140048
+
  0013fd98: 3402007e ori r2,r0,0x007e        |
  0013fed8: 34060017 ori r6,r0,0x0017 Katana
+
  0013fd9c: 3c018016 lui r1,0x8016            |
 
+
  0013fda0: a422699c sh r2,0x699c(r1)         |{{f/store|store turn display X offset}}
  0013fedc: 0804ffd5 j 0x 0013ff54 Skip Next Section
+
  0013fda4: 00111080 sll r2,r17,0x02          |{{f/std|Action Menu ID*4}}
  0013fee0: 34060001 ori r6,r0,0x0001
+
  0013fda8: 3c018016 lui r1,0x8016            |
 
+
  0013fdac: a420699e sh r0,0x699e(r1)        |{{f/store|store Ability name display}}
Not Item/throw/draw out -- Count numeber of abilities
+
  0013fdb0: 3c018017 lui r1,0x8017            |
  0013fee4: 00008021 addu r16,r0,r0
+
  0013fdb4: 00220821 addu r1,r1,r2            |
  0013fee8: 3404ffff ori r4,r0,0xffff
+
  0013fdb8: 84239266 lh r3,-0x6d9a(r1)        |{{f/load|80169266 + Action menu byte*4 (if action menu calls inventory or not?)}}  * details in notes
  0013feec: 3c038017 lui r3,0x8017
+
  0013fdbc: 34020001 ori r2,r0,0x0001        |
  0013fef0: 8c634048 lw r3,0x4048(r3) Load ability list
+
  0013fdc0: 14620048 bne r3,r2,0x0013fee4    {{f/Cond|<nowiki>If used Action Menu Call inventory (r3 = 0x01)</nowiki>}}
  0013fef4: 00000000 nop
+
  0013fdc4: 00003021 addu r6,r0,r0            |{{f/std|Defaut Menu dimension/Tags}}
  0013fef8: 94620000 lhu r2,0x0000(r3) load ability
+
0013fefc: 00000000 nop
+
                                            {{f/sec|Item/Throw/Draw Out - Set usability based on item quantity}}
  0013ff00: 10440005 beq r2,r4,0x 0013ff18 branch if ability doesn't exist
+
  0013fdc8: 3c048017 lui r4,0x8017                |{{f/std|}}
  0013ff04: 00000000 nop
+
  0013fdcc: 8c844048 lw r4,0x4048(r4)             |{{f/adr|load ability list address}}
  0013ff08: 26100001 addiu r16,r16,0x0001
+
0013fdd0: 0c04fe80 jal 0x0013fa00              |{{f/jal|0013fa00_-_0013fa34|0013fa00_-_0013fa34}}
  0013ff0c: 2a020040 slti r2,r16,0x0040 set if counter in ability list bounds
+
  0013fdd4: 248501ec addiu r5,r4,0x01ec          |{{f/std|Item Used}}
  0013ff10: 1440fff8 bne r2,r0,0x 0013fef4 branch back if so
+
0013fdd8: 00408021 addu r16,r2,r0               |{{f/std|<nowiki>r16 = # of abilities</nowiki>}}
  0013ff14: 24630002 addiu r3,r3,0x0002 list++
+
  0013fddc: 3c058017 lui r5,0x8017               |
 
+
  0013fde0: 8ca54048 lw r5,0x4048(r5)             |{{f/adr|load skillset data}}
  0013ff18: 1620000f bne r17,r0,0x 0013ff58 branch if not using Default
+
  0013fde4: 02003021 addu r6,r16,r0               {{f/Cond| of abilities}}
  0013ff1c: 34020003 ori r2,r0,0x0003
+
  0013fde8: 24a40148 addiu r4,r5,0x0148          |{{f/std|<nowiki>r4 = Turns</nowiki>}}
  0013ff20: 1a00000d blez r16,0x 0013ff58 branch if no abilities found
+
  0013fdec: 0c04fe8e jal 0x0013fa38              |{{f/jal|0013fa38_-_0013fa68|0013fa38_-_0013fa68}} {{f/std|do for each r6, load from r5, store in r4 **Set Turns**}}
  0013ff24: 00002821 addu r5,r0,r0
+
0013fdf0: 24a502e2 addiu r5,r5,0x02e2           |{{f/std|<nowiki>r5 = turns</nowiki>}}
Default
+
  0013fdf4: 00003021 addu r6,r0,r0                |
  0013ff28: 3c038017 lui r3,0x8017
+
  0013fdf8: 1a000019 blez r16,0x0013fe60          {{f/Cond|branch if no abilities found}}
  0013ff2c: 8c634048 lw r3,0x4048(r3) load ability list
+
0013fdfc: 00002821 addu r5,r0,r0                    |{{f/std|}}
  0013ff30: 00000000 nop
+
0013fe00: 34070004 ori r7,r0,0x0004                |
0013ff34: 00651021 addu r2,r3,r5
+
  0013fe04: 3c048015 lui r4,0x8015                    |
<Loop> Load able to use byte>
+
  0013fe08: 2484d264 addiu r4,r4,0xd264              |{{f/std|load availability Data}}
  0013ff38: 904201ec lbu r2,0x01ec(r2) load 0x1ec byte (able to use ability?
+
  0013fe0c: 3c038017 lui r3,0x8017                    |
  0013ff3c: 00000000 nop
+
  0013fe10: 8c634048 lw r3,0x4048(r3)                 |{{f/adr|load Ability ID list}}
0013ff40: 1440ffe6 bne r2,r0,0x 0013fedc branch if unable to use?
+
                                                    {{f/bloop|LOOP : Grey Out item abilities}}
  0013ff44: 24a50001 addiu r5,r5,0x0001 counter++
+
  0013fe14: 00000000 nop                                  |{{f/std|}}
  0013ff48: 00b0102a slt r2,r5,r16 set if in bounds?
+
  0013fe18: 94620000 lhu r2,0x0000(r3)                   |{{f/load|load ability}}
  0013ff4c: 1440fffa bne r2,r0,0x 0013ff38 branch if so
+
  0013fe1c: 3c018006 lui r1,0x8006                        |
  0013ff50: 00651021 addu r2,r3,r5
+
  0013fe20: 00220821 addu r1,r1,r2                        |
  0013ff54: 34020003 ori r2,r0,0x0003
+
  0013fe24: 902296e0 lbu r2,-0x6920(r1)                   |{{f/load|load item quantity}}
0013ff58: 1622000a bne r17,r2,0x 0013ff84 branch if not using Math Skill
+
  0013fe28: 00000000 nop                                  |
  0013ff5c: 00000000 nop
+
  0013fe2c: a46200a4 sh r2,0x00a4(r3)                     |{{f/store|store item quantity}}
 
+
  0013fe30: 946200a4 lhu r2,0x00a4(r3)                    |{{f/load|load item quantity}}
Math Skill
+
  0013fe34: 00000000 nop                                  |
  0013ff60: 1aa00008 blez r21,0x 0013ff84 Branch if loading abilities
+
  0013fe38: 14400003 bne r2,r0,0x0013fe48                {{f/Cond|If No items}}
  0013ff64: 34020002 ori r2,r0,0x0002
+
  0013fe3c: 00000000 nop                                      |{{f/std|}}
  0013ff68: 34120088 ori r18,r0,0x0088 if math skill, r18 = 0x88
+
  0013fe40: 0804ff93 j 0x0013fe4c                            |{{f/std|}}
  0013ff6c: 3c018016 lui r1,0x8016
+
  0013fe44: a4870000 sh r7,0x0000(r4)                         |{{f/store|store grayed out ability}}
  0013ff70: a42269a0 sh r2,0x69a0(r1) store 0x0002
+
                                                        '''Else : if item quantity != 0'''
  0013ff74: 3c018016 lui r1,0x8016
+
  0013fe48: 34060001 ori r6,r0,0x0001                        |{{f/std|set ability usable?}}
0013ff78: a42269a2 sh r2,0x69a2(r1) store 0x0002
+
  0013fe4c: 24840002 addiu r4,r4,0x0002                  |{{f/std|count another availability if item is usable}}
  0013ff7c: 08050010 j 0x 00140040
+
  0013fe50: 24a50001 addiu r5,r5,0x0001                  |{{f/std|counter + 1}}
0013ff80: 34070009 ori r7,r0,0x0009 jump down, Set control value = 0x09
+
  0013fe54: 00b0102a slt r2,r5,r16                       |
 
+
  0013fe58: 1440ffee bne r2,r0,0x0013fe14            {{f/eloop|Loop - do for all Items in list}}
Item - Throw - Draw Out - Default
+
  0013fe5c: 24630002 addiu r3,r3,0x0002                  |{{f/std|next ability ID}}
  0013ff84: 10c00019 beq r6,r0,0x 0013ffec branch if not item/throw/draw out
+
  0013fe60: 10c00003 beq r6,r0,0x0013fe70        {{f/Cond|branch if there is consumable items}}
  0013ff88: 00000000 nop
+
  0013fe64: 34070007 ori r7,r0,0x0007            |{{f/std|<nowiki>Control Value = 0x07</nowiki>}}
  0013ff8c: 16200018 bne r17,r0,0x 0013fff0 branch if not default
+
  0013fe68: 0804ffa7 j 0x0013fe9c                    |{{f/std|}}
  0013ff90: 02003021 addu r6,r16,r0 For Each Ability
+
  0013fe6c: 2652fffc addiu r18,r18,0xfffc            |{{f/std|<nowiki>if items are available, r18 = 0xa8</nowiki>}}
Default
+
                                                '''Else : if no items with quantity > 0 found'''
  0013ff94: 3c058017 lui r5,0x8017
+
  0013fe70: 02003021 addu r6,r16,r0                   |{{f/std|}}
  0013ff98: 8ca54048 lw r5,0x4048(r5) load Ability List
+
0013fe74: 34120094 ori r18,r0,0x0094                |{{f/std|<nowiki>if no items can be found, r18 = 0x94</nowiki>}}
  0013ff9c: 2652fff8 addiu r18,r18,0xfff8 if default menu, r18 = 0xa4
+
  0013fe78: 3c058017 lui r5,0x8017                    |
  0013ffa0: 24a400a4 addiu r4,r5,0x00a4 "Stock", "MP" List
+
  0013fe7c: 8ca54048 lw r5,0x4048(r5)                |{{f/adr|<nowiki>r5 = skillset abilities</nowiki>}}
  0013ffa4: 0c04fe80 jal 0x 0013fa00 Set MP Values
+
  0013fe80: 34020002 ori r2,r0,0x0002                |
0013ffa8: 24a501ec addiu r5,r5,0x01ec Items used list, MP list
+
  0013fe84: 3c018016 lui r1,0x8016                    |
0013ffac: 3c058017 lui r5,0x8017
+
  0013fe88: a42269a2 sh r2,0x69a2(r1)                 |{{f/store|Remove "stock" display numbers}}
  0013ffb0: 8ca54048 lw r5,0x4048(r5)
+
  0013fe8c: 24a400a4 addiu r4,r5,0x00a4              |{{f/std|<nowiki>r4 = item quantities</nowiki>}}
  0013ffb4: 02003021 addu r6,r16,r0 For Each Ability
+
  0013fe90: 0c04fe8e jal 0x0013fa38                  |{{f/jal|0013fa38_-_0013fa68|0013fa38_-_0013fa68}}
  0013ffb8: 24a40148 addiu r4,r5,0x0148 Turns
+
  0013fe94: 24a502e2 addiu r5,r5,0x02e2              |{{f/std|<nowiki>r5 = 01 data</nowiki>}}
  0013ffbc: 0c04fe8e jal 0x 0013fa38 store turns
+
  0013fe98: 34070008 ori r7,r0,0x0008                |{{f/std|<nowiki>Control value = 0x08</nowiki>}}
  0013ffc0: 24a502e2 addiu r5,r5,0x02e2 Turns
+
  0013fe9c: 34093800 ori r9,r0,0x3800            |{{f/std|Store Item display}}
  0013ffc4: 34070006 ori r7,r0,0x0006
+
  0013fea0: 3c048016 lui r4,0x8016                |
  0013ffc8: 3c048016 lui r4,0x8016
+
  0013fea4: 2484699a addiu r4,r4,0x699a          |{{f/std|8016699a}}
0013ffcc: 2484699a addiu r4,r4,0x699a 8016699a
+
  0013fea8: 94820000 lhu r2,0x0000(r4)            |{{f/load|load Stock numbers display location}}
  0013ffd0: 94820000 lhu r2,0x0000(r4)
+
  0013feac: 3c038016 lui r3,0x8016                |
  0013ffd4: 3c038016 lui r3,0x8016
+
  0013feb0: 9463699c lhu r3,0x699c(r3)           |{{f/load|load Turns display location}}
0013ffd8: 9463699c lhu r3,0x699c(r3)
+
  0013feb4: 2442fffc addiu r2,r2,0xfffc          |{{f/std|move left by 4}}
  0013ffdc: 2442fff8 addiu r2,r2,0xfff8 r2 -= 0x08
+
  0013feb8: 2463fffc addiu r3,r3,0xfffc          |{{f/std|move left by 4}}
  0013ffe0: 2463fff8 addiu r3,r3,0xfff8 r3 -= 0x08
+
  0013febc: a4820000 sh r2,0x0000(r4)             |{{f/store|store new location}}
  0013ffe4: 0805000e j 0x 00140038
+
  0013fec0: 34020007 ori r2,r0,0x0007            |
0013ffe8: a4820000 sh r2,0x0000(r4)
+
0013fec4: 3c018016 lui r1,0x8016                |
 
+
0013fec8: a423699c sh r3,0x699c(r1)            |{{f/store|store new location}}
Anything Else
+
  0013fecc: 1622005e bne r17,r2,0x00140048        {{f/Cond|branch if not Draw out}}
  0013ffec: 02003021 addu r6,r16,r0
+
  0013fed0: 34060011 ori r6,r0,0x0011            |{{f/std|Item/Throw}}
  0013fff0: 3c058017 lui r5,0x8017
+
  0013fed4: 08050012 j 0x00140048                    {{f/jump|Jump}}
  0013fff4: 8ca54048 lw r5,0x4048(r5)
+
  0013fed8: 34060017 ori r6,r0,0x0017                |{{f/std|Katana}}
  0013fff8: 34120094 ori r18,r0,0x0094 if menu cannot not use items, is not default, or isn't math, r18 = 0x94
+
                                                -- 2 shitty lines, reached by backward branching --
  0013fffc: 24a400a4 addiu r4,r5,0x00a4 "Stock, "MP"
+
  0013fedc: 0804ffd5 j 0x0013ff54                {{f/jump|Skip Next Section}}
  00140000: 0c04fe8e jal 0x 0013fa38
+
  0013fee0: 34060001 ori r6,r0,0x0001            |{{f/std|Dimension Tag if at least one Ability in list has a MP cost}}
00140004: 24a502e2 addiu r5,r5,0x02e2 Used Item List, Mp List
+
  00140008: 34070005 ori r7,r0,0x0005
+
                                            {{f/sec|Not Item/throw/draw out }}
  0014000c: 34020002 ori r2,r0,0x0002
+
  0013fee4: 00008021 addu r16,r0,r0              |{{f/std|Initialize counter}}
  00140010: 3c018016 lui r1,0x8016
+
  0013fee8: 3404ffff ori r4,r0,0xffff            |
  00140014: a42269a2 sh r2,0x69a2(r1) store no stock/mp display?
+
  0013feec: 3c038017 lui r3,0x8017                |
  00140018: 3c028016 lui r2,0x8016
+
  0013fef0: 8c634048 lw r3,0x4048(r3)            |{{f/adr|Pointer to Ability List}}
  0014001c: 9442699a lhu r2,0x699a(r2) load mp/stock display location
+
                                                {{f/bloop|LOOP - Count listed Abilities}}
  00140020: 3c038016 lui r3,0x8016
+
  0013fef4: 00000000 nop                              |{{f/std|}}
  00140024: 9463699c lhu r3,0x699c(r3) turns display location
+
  0013fef8: 94620000 lhu r2,0x0000(r3)                |{{f/load|Ability ID}}
  00140028: 2442fffc addiu r2,r2,0xfffc
+
  0013fefc: 00000000 nop                              |
  0014002c: 2463fffc addiu r3,r3,0xfffc move to the left by 4
+
  0013ff00: 10440005 beq r2,r4,0x0013ff18            {{f/Cond|<nowiki>if ID = 0xfff : Exit Loop (end of listed abilities)</nowiki>}}
  00140030: 3c018016 lui r1,0x8016
+
  0013ff04: 00000000 nop                              |{{f/std|}}
00140034: a422699a sh r2,0x699a(r1) store new
+
  0013ff08: 26100001 addiu r16,r16,0x0001            |{{f/std|Counter + 1}}
Default Return
+
  0013ff0c: 2a020040 slti r2,r16,0x0040              |{{f/std|Check list limit}}
  00140038: 3c018016 lui r1,0x8016
+
  0013ff10: 1440fff8 bne r2,r0,0x0013fef4        {{f/eloop|Loop until last Ability or end of list}}
  0014003c: a423699c sh r3,0x699c(r1) store new display location
+
  0013ff14: 24630002 addiu r3,r3,0x0002              |{{f/adr|Dynamic list pointer (halfword offset)}}
 
+
   
  00140040: 34097000 ori r9,r0,0x7000 store ability type
+
                                                {{f/sec|Defaut Action Menu (0x00)}}
  00140044: 34060005 ori r6,r0,0x0005
+
  0013ff18: 1620000f bne r17,r0,0x0013ff58        {{f/Cond|<nowiki>if Used Action Menu = Default</nowiki>}}
 
+
  0013ff1c: 34020003 ori r2,r0,0x0003                |{{f/std|}}
  00140048: 3c028017 lui r2,0x8017
+
  0013ff20: 1a00000d blez r16,0x0013ff58              {{f/Cond|If There is no Ability in List : Branch to}} {{f/loc| Next Section}}
  0014004c: 8c423cb8 lw r2,0x3cb8(r2) 80166b10 - Menu Data
+
  0013ff24: 00002821 addu r5,r0,r0                    |{{f/std|Initialize counter}}
  00140050: 00002821 addu r5,r0,r0
+
  0013ff28: 3c038017 lui r3,0x8017                        |{{f/std|}}
  00140054: a45200b8 sh r18,0x00b8(r2) store menu type? 3 times. 0x94 means no abilities available?
+
0013ff2c: 8c634048 lw r3,0x4048(r3)                |{{f/adr|Pointer to Ability List}}
  00140058: a45200c0 sh r18,0x00c0(r2)
+
0013ff30: 00000000 nop                              |
  0014005c: a45200c8 sh r18,0x00c8(r2)
+
0013ff34: 00651021 addu r2,r3,r5                    |{{f/adr|Dynamic Pointer to Ability List (Byte offset)}}
  00140060: a44700e0 sh r7,0x00e0(r2) store menu headers set
+
                                                    {{f/bloop|Loop - MP Cost}}
  00140064: 1a000031 blez r16,0x 0014012c branch if no abilities found
+
0013ff38: 904201ec lbu r2,0x01ec(r2)                    |{{f/load|load MP cost}}
  00140068: a44600ee sh r6,0x00ee(r2) store skillset type?
+
0013ff3c: 00000000 nop                                  |
 
+
0013ff40: 1440ffe6 bne r2,r0,0x0013fedc                {{f/Cond|Branch back if ability has MP cost (set custom menu dimensions/tags) and exit loop}} {{f/std|Seriously ?}}
0014006c: 34080008 ori r8,r0,0x0008
+
0013ff44: 24a50001 addiu r5,r5,0x0001                  |{{f/std|counter++}}
  00140070: 340a0006 ori r10,r0,0x0006
+
0013ff48: 00b0102a slt r2,r5,r16                        |{{f/std|set if yet to search all abilities}}
  00140074: 3c068017 lui r6,0x8017
+
0013ff4c: 1440fffa bne r2,r0,0x0013ff38            {{f/eloop|Loop (all listed abilities)}}
  00140078: 8cc64048 lw r6,0x4048(r6) load skillset address
+
0013ff50: 00651021 addu r2,r3,r5                        |{{f/adr|Dynamic Pointer to Ability List (Byte offset)}}
  0014007c: 3c078015 lui r7,0x8015
+
0013ff54: 34020003 ori r2,r0,0x0003                    |
  00140080: 24e7d264 addiu r7,r7,0xd264 14d264
+
  00140084: 00c02021 addu r4,r6,r0
+
                                                {{f/sec|Mathematics Action Menu (0x03)}}
 
+
0013ff58: 1622000a bne r17,r2,0x0013ff84        {{f/Cond|If Action Menu is Mathematics}}
<Loop> Set usability for default abilities based on MP
+
0013ff5c: 00000000 nop                              |{{f/std|}}
  00140088: 94c20000 lhu r2,0x0000(r6) load ability ID
+
0013ff60: 1aa00008 blez r21,0x0013ff84              {{f/Cond|If Not Loading Spell list (Preset value <> 0x00) : }} {{f/loc|Skip Section}}
  0014008c: 00000000 nop
+
0013ff64: 34020002 ori r2,r0,0x0002                    |{{f/std|}}
  00140090: 00491025 or r2,r2,r9 Add ability type flags
+
0013ff68: 34120088 ori r18,r0,0x0088                    |{{f/std|<nowiki>if math skill, r18 = 0x88</nowiki>}}
  00140094: 1620000e bne r17,r0,0x 001400d0 branch if not default
+
0013ff6c: 3c018016 lui r1,0x8016                        |
  00140098: a4c20000 sh r2,0x0000(r6) store ability with type flags
+
0013ff70: a42269a0 sh r2,0x69a0(r1)                    |{{f/store|store 0x0002}}
Default
+
0013ff74: 3c018016 lui r1,0x8016                        |
  0014009c: 96c2002c lhu r2,0x002c(r22) load MP
+
0013ff78: a42269a2 sh r2,0x69a2(r1)                    |{{f/store|store 0x0002}}
  001400a0: 908301ec lbu r3,0x01ec(r4) load MP cost?
+
0013ff7c: 08050010 j 0x00140040                        |
  001400a4: 00000000 nop
+
0013ff80: 34070009 ori r7,r0,0x0009                    |{{f/std|<nowiki>jump down, Set control value = 0x09</nowiki>}}
  001400a8: 00431023 subu r2,r2,r3 MP - MP cost
+
  001400ac: 04410006 bgez r2,0x 001400c8 branch if unit has enough MP
+
                                                {{f/sec|Not Mathematics (Item - Throw - Draw Out - Default)}}
  001400b0: 00000000 nop
+
0013ff84: 10c00019 beq r6,r0,0x0013ffec        {{f/Cond|If Ability Has a MP cost}}
  001400b4: 90820334 lbu r2,0x0334(r4) load displayed turns until resolution
+
0013ff88: 00000000 nop                              |{{f/std|}}
  001400b8: 00000000 nop
+
0013ff8c: 16200018 bne r17,r0,0x0013fff0            {{f/Cond|If Not Defaut Action Menu : }} {{f/loc|Skip Section}}
001400bc: 10400002 beq r2,r0,0x 001400c8 branch if acting now
+
0013ff90: 02003021 addu r6,r16,r0                  |{{f/std|For Each Ability}}
  001400c0: 00000000 nop
+
0013ff94: 3c058017 lui r5,0x8017                    |
  001400c4: a4e80000 sh r8,0x0000(r7) set ability blinking red
+
0013ff98: 8ca54048 lw r5,0x4048(r5)                |{{f/adr|Pointer to Ability List}}
  001400c8: 12200003 beq r17,r0,0x 001400d8 branch if default
+
0013ff9c: 2652fff8 addiu r18,r18,-0x0008            |{{f/std|<nowiki>if default menu, r18 = 0xa4 (menu width includes MP)</nowiki>}}
  001400cc: 00000000 nop
+
0013ffa0: 24a400a4 addiu r4,r5,0x00a4              |{{f/adr|Pointer MP List}}
001400d0: 162a0010 bne r17,r10,0x 00140114 branch if not Monster
+
0013ffa4: 0c04fe80 jal 0x0013fa00                  |{{f/jal|0013fa00_-_0013fa34|Set MP Values}} {{f/std|Copy data from r5 (byte) to r4(halfwords)}}
  001400d4: 00000000 nop
+
0013ffa8: 24a501ec addiu r5,r5,0x01ec              |{{f/adr|Pointer MP List}}
Default and Monster
+
0013ffac: 3c058017 lui r5,0x8017                    |
001400d8: 90820290 lbu r2,0x0290(r4) load silence/persevere/reflect flags
+
0013ffb0: 8ca54048 lw r5,0x4048(r5)                |{{f/adr|Pointer to Ability List}}
  001400dc: 00000000 nop
+
0013ffb4: 02003021 addu r6,r16,r0                  |{{f/std|For Each Ability}}
001400e0: 30420002 andi r2,r2,0x0002
+
0013ffb8: 24a40148 addiu r4,r5,0x0148              |{{f/adr|Pointer Turn List}}
  001400e4: 1040000b beq r2,r0,0x 00140114 branch if not silence-affected
+
0013ffbc: 0c04fe8e jal 0x0013fa38                  |{{f/jal|0013fa38_-_0013fa68|Transfer Turns}} {{f/std|Copy data from r5 (byte) to r4(halfwords)}}
  001400e8: 00000000 nop
+
0013ffc0: 24a502e2 addiu r5,r5,0x02e2              |{{f/adr|Pointer Turn List}}
001400ec: 90820334 lbu r2,0x0334(r4) load displayed turns until resolution
+
0013ffc4: 34070006 ori r7,r0,0x0006                |{{f/std|<nowiki>menu header type = "Ability"    "Ref" "MP" "Turns"</nowiki>}}
  001400f0: 00000000 nop
+
0013ffc8: 3c048016 lui r4,0x8016                    |
  001400f4: 10400007 beq r2,r0,0x 00140114 branch if ability acts now
+
0013ffcc: 2484699a addiu r4,r4,0x699a              |{{f/std|8016699a}}
001400f8: 00000000 nop
+
0013ffd0: 94820000 lhu r2,0x0000(r4)                |{{f/load|load "MP" header display location}}
001400fc: 92c20059 lbu r2,0x0059(r22) load status
+
0013ffd4: 3c038016 lui r3,0x8016                    |
  00140100: 00000000 nop
+
0013ffd8: 9463699c lhu r3,0x699c(r3)                |{{f/load|load "turns" header display}}
  00140104: 30420008 andi r2,r2,0x0008
+
0013ffdc: 2442fff8 addiu r2,r2,0xfff8              |{{f/std|<nowiki>r2 -= 0x08</nowiki>}}
  00140108: 10400002 beq r2,r0,0x 00140114 branch if not silenced
+
0013ffe0: 2463fff8 addiu r3,r3,0xfff8              |{{f/std|<nowiki>r3 -= 0x08</nowiki>}}
  0014010c: 00000000 nop
+
0013ffe4: 0805000e j 0x00140038                    |
  00140110: a4e80000 sh r8,0x0000(r7) set skill blinking red (0x08)
+
0013ffe8: a4820000 sh r2,0x0000(r4)                |{{f/store|store new "MP" header display location}}
  00140114: 24e70002 addiu r7,r7,0x0002
+
                                                '''Else : Ability Without MP Cost (Or not default action menu)'''
 
+
0013ffec: 02003021 addu r6,r16,r0                  |{{f/std|}}
  00140118: 24840001 addiu r4,r4,0x0001
+
0013fff0: 3c058017 lui r5,0x8017                    |
  0014011c: 24a50001 addiu r5,r5,0x0001
+
0013fff4: 8ca54048 lw r5,0x4048(r5)                |
  00140120: 00b0102a slt r2,r5,r16 do for all abilities
+
0013fff8: 34120094 ori r18,r0,0x0094                |{{f/std|<nowiki>if menu cannot not use items, is not default, or isn't math, r18 = 0x94</nowiki>}}
  00140124: 1440ffd8 bne r2,r0,0x 00140088
+
0013fffc: 24a400a4 addiu r4,r5,0x00a4              |{{f/adr|Pointer MP/Stock List}}
  00140128: 24c60002 addiu r6,r6,0x0002
+
00140000: 0c04fe8e jal 0x0013fa38                  |{{f/jal|0013fa38_-_0013fa68|Transfer Turns}} {{f/std|Copy data from r5 (byte) to r4(halfwords)}}
</Loop>
+
00140004: 24a502e2 addiu r5,r5,0x02e2              |{{f/adr|Pointer MP/Stock List}}
If no abilites found?
+
00140008: 34070005 ori r7,r0,0x0005                |
  0014012c: 1600000e bne r16,r0,0x 00140168 branch if abilities found
+
0014000c: 34020002 ori r2,r0,0x0002                |
  00140130: 34037000 ori r3,r0,0x7000
+
00140010: 3c018016 lui r1,0x8016                    |
If no usable abilities found?
+
00140014: a42269a2 sh r2,0x69a2(r1)                |{{f/store|store no stock/mp display?}}
  00140134: 3c028017 lui r2,0x8017
+
00140018: 3c028016 lui r2,0x8016                    |
  00140138: 8c423cb8 lw r2,0x3cb8(r2) load menu data
+
0014001c: 9442699a lhu r2,0x699a(r2)                |{{f/load|load mp/stock display location}}
  0014013c: 34100001 ori r16,r0,0x0001
+
00140020: 3c038016 lui r3,0x8016                    |
  00140140: a44000e0 sh r0,0x00e0(r2) store no menu type
+
00140024: 9463699c lhu r3,0x699c(r3)                |{{f/load|turns display location}}
  00140144: 3c028017 lui r2,0x8017
+
00140028: 2442fffc addiu r2,r2,0xfffc              |
  00140148: 8c424048 lw r2,0x4048(r2) load skillset
+
0014002c: 2463fffc addiu r3,r3,0xfffc              |{{f/std|move to the left by 4}}
  0014014c: 00000000 nop
+
00140030: 3c018016 lui r1,0x8016                    |
  00140150: a4430000 sh r3,0x0000(r2) store not-usable
+
00140034: a422699a sh r2,0x699a(r1)                |{{f/store|store new}}
  00140154: a44000a4 sh r0,0x00a4(r2)
+
00140038: 3c018016 lui r1,0x8016                |{{f/std|}}
  00140158: a4400148 sh r0,0x0148(r2)
+
0014003c: a423699c sh r3,0x699c(r1)            |{{f/store|store new display location}}
  0014015c: 34020004 ori r2,r0,0x0004
+
00140040: 34097000 ori r9,r0,0x7000        |{{f/std|Default Ability Type}}
  00140160: 3c018015 lui r1,0x8015
+
00140044: 34060005 ori r6,r0,0x0005        |
  00140164: a422d264 sh r2,-0x2d9c(r1) store greyed out skillset?
+
00140048: 3c028017 lui r2,0x8017            |
 
+
0014004c: 8c423cb8 lw r2,0x3cb8(r2)        |{{f/adr|80166b10 - Menu Data}}
  00140168: 3c048017 lui r4,0x8017
+
00140050: 00002821 addu r5,r0,r0            |
0014016c: 8c843cb8 lw r4,0x3cb8(r4) load menu
+
00140054: a45200b8 sh r18,0x00b8(r2)        |{{f/store|store menu type? 3 times. 0x94 means no abilities available?}}
  00140170: 34020030 ori r2,r0,0x0030
+
00140058: a45200c0 sh r18,0x00c0(r2)        |
  00140174: a48200be sh r2,0x00be(r4) store 0xbe byte
+
0014005c: a45200c8 sh r18,0x00c8(r2)        |
  00140178: 2a020007 slti r2,r16,0x0007
+
00140060: a44700e0 sh r7,0x00e0(r2)        |{{f/store|store menu headers set}}
0014017c: 14400009 bne r2,r0,0x 001401a4 set if abilities found < 7
+
00140064: 1a000031 blez r16,0x0014012c      {{f/Cond|If There is abilities in the list}}
00140180: 34020006 ori r2,r0,0x0006
+
00140068: a44600ee sh r6,0x00ee(r2)        |{{f/store|store skillset type?}}
00140184: 2602fffa addiu r2,r16,0xfffa abilities - 6
+
0014006c: 34080008 ori r8,r0,0x0008            |{{f/std|blinking red}}
00140188: 3c018016 lui r1,0x8016
+
00140070: 340a0006 ori r10,r0,0x0006            |
0014018c: a4226996 sh r2,0x6996(r1) store number of scrollable slots
+
00140074: 3c068017 lui r6,0x8017                |
00140190: 34020006 ori r2,r0,0x0006
+
00140078: 8cc64048 lw r6,0x4048(r6)            |{{f/adr|Pointer to Ability List}}
  00140194: 3c018016 lui r1,0x8016
+
0014007c: 3c078015 lui r7,0x8015                |
  00140198: a4226994 sh r2,0x6994(r1) store 6 number of displayed slots
+
00140080: 24e7d264 addiu r7,r7,0xd264          |{{f/adr|Pointer to Ability Display}}
  0014019c: 08050072 j 0x 001401c8
+
00140084: 00c02021 addu r4,r6,r0                |{{f/adr|Pointer to Ability List}}
  001401a0: 00000000 nop
+
                                                {{f/bloop|Loop - Set usability for default abilities based on MP}}
 
+
00140088: 94c20000 lhu r2,0x0000(r6)                |{{f/load|load ability ID}}
  001401a4: 00501023 subu r2,r2,r16
+
0014008c: 00000000 nop                              |
  001401a8: 3c018016 lui r1,0x8016
+
00140090: 00491025 or r2,r2,r9                      |{{f/std|Add ability type flags (r9 is 0x7000)}}
  001401ac: a4206996 sh r0,0x6996(r1) store number of scrollable slots
+
00140094: 1620000e bne r17,r0,0x001400d0            {{f/Cond|If Action Menu ID is Default (0x00)}}
  001401b0: 3c018016 lui r1,0x8016
+
00140098: a4c20000 sh r2,0x0000(r6)                |{{f/store|store ability with type flags}}
  001401b4: a4306994 sh r16,0x6994(r1) store number of abilities
+
0014009c: 96c2002c lhu r2,0x002c(r22)                  |{{f/load|load Unit MP}}
  001401b8: 948300be lhu r3,0x00be(r4)
+
001400a0: 908301ec lbu r3,0x01ec(r4)                    |{{f/load|load MP cost}}
  001401bc: 000210c0 sll r2,r2,0x03
+
001400a4: 00000000 nop                                  |
  001401c0: 00621821 addu r3,r3,r2
+
001400a8: 00431023 subu r2,r2,r3                        |{{f/std|MP - MP cost}}
  001401c4: a48300be sh r3,0x00be(r4)
+
001400ac: 04410006 bgez r2,0x001400c8                  {{f/Cond|If unit has not enough MP}}
 
+
001400b0: 00000000 nop                                      |{{f/std|}}
  001401c8: 3c028017 lui r2,0x8017
+
001400b4: 90820334 lbu r2,0x0334(r4)                        |{{f/load|Load CT}}
  001401cc: 8c424038 lw r2,0x4038(r2) load block #
+
001400b8: 00000000 nop                                      |
  001401d0: 34030001 ori r3,r0,0x0001
+
001400bc: 10400002 beq r2,r0,0x001400c8                    {{f/Cond|If There is a CT}}
  001401d4: 00021280 sll r2,r2,0x0a
+
001400c0: 00000000 nop                                          |{{f/std|}}
  001401d8: 3c018017 lui r1,0x8017
+
001400c4: a4e80000 sh r8,0x0000(r7)                            |{{f/store|Set ability blinking red}}
  001401dc: 00220821 addu r1,r1,r2
+
001400c8: 12200003 beq r17,r0,0x001400d8                {{f/Cond|Avoid Monster check and go to monster-default section}} {{f/std|could just be a jump…}}
  001401e0: ac239870 sw r3,-0x6790(r1) 169870
+
001400cc: 00000000 nop                                      |{{f/std|}}
  001401e4: 3c018017 lui r1,0x8017
+
001400d0: 162a0010 bne r17,r10,0x00140114          {{f/Cond|If Action Menu is Monster (0x06)  (Or Default)}}
  001401e8: 00220821 addu r1,r1,r2
+
001400d4: 00000000 nop                                  |{{f/std|}}
  001401ec: ac209874 sw r0,-0x678c(r1) 169874
+
001400d8: 90820290 lbu r2,0x0290(r4)                    |{{f/load|load silence/persevere/reflect flags}}
  001401f0: 3c018017 lui r1,0x8017
+
001400dc: 00000000 nop                                  |
  001401f4: 00220821 addu r1,r1,r2
+
001400e0: 30420002 andi r2,r2,0x0002                    |
  001401f8: ac239878 sw r3,-0x6788(r1) 169878
+
001400e4: 1040000b beq r2,r0,0x00140114                {{f/Cond|If Affected by silance}}
  001401fc: 8fbf0054 lw r31,0x0054(r29)
+
001400e8: 00000000 nop                                      |{{f/std|}}
 +
001400ec: 90820334 lbu r2,0x0334(r4)                        |{{f/load|Load CT}}
 +
001400f0: 00000000 nop                                      |
 +
001400f4: 10400007 beq r2,r0,0x00140114                    {{f/Cond|If no CT : Avoid blinking red}}
 +
001400f8: 00000000 nop                                          |
 +
001400fc: 92c20059 lbu r2,0x0059(r22)                      |{{f/load|Load current status 2}}
 +
00140100: 00000000 nop                                      |
 +
00140104: 30420008 andi r2,r2,0x0008                        |
 +
00140108: 10400002 beq r2,r0,0x00140114                    {{f/Cond|If Unit has Silence}}
 +
0014010c: 00000000 nop                                          |{{f/std|}}
 +
00140110: a4e80000 sh r8,0x0000(r7)                            |{{f/store|set skill blinking red (0x08)}}
 +
00140114: 24e70002 addiu r7,r7,0x0002              |{{f/std|Dynamic Pointer to Ability display (Halfword offset)}}
 +
00140118: 24840001 addiu r4,r4,0x0001              |{{f/adr|Dynamic Pointer to Ability List (Byte offset)}}
 +
0014011c: 24a50001 addiu r5,r5,0x0001              |{{f/std|Loop counter + 1}}
 +
00140120: 00b0102a slt r2,r5,r16                    |
 +
00140124: 1440ffd8 bne r2,r0,0x00140088        {{f/eloop|do for all abilities}}
 +
00140128: 24c60002 addiu r6,r6,0x0002              |{{f/adr|Dynamic Pointer to Ability List (Halfword offset)}}
 +
0014012c: 1600000e bne r16,r0,0x00140168    {{f/Cond|If There is no Ability in list}}
 +
00140130: 34037000 ori r3,r0,0x7000            |{{f/std|}}
 +
00140134: 3c028017 lui r2,0x8017                |
 +
00140138: 8c423cb8 lw r2,0x3cb8(r2)            |{{f/adr|load menu data}}
 +
0014013c: 34100001 ori r16,r0,0x0001            |
 +
00140140: a44000e0 sh r0,0x00e0(r2)            |{{f/store|store no menu type}}
 +
00140144: 3c028017 lui r2,0x8017                |
 +
00140148: 8c424048 lw r2,0x4048(r2)            |{{f/adr|Pointer to Ability List}}
 +
0014014c: 00000000 nop                          |
 +
00140150: a4430000 sh r3,0x0000(r2)            |{{f/store|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)            |{{f/store|store greyed out skillset?}}
 +
00140168: 3c048017 lui r4,0x8017                |
 +
0014016c: 8c843cb8 lw r4,0x3cb8(r4)        |{{f/adr|load menu data}}
 +
  00140170: 34020030 ori r2,r0,0x0030        |
 +
  00140174: a48200be sh r2,0x00be(r4)         |{{f/store|store 0xbe byte}}
 +
  00140178: 2a020007 slti r2,r16,0x0007      |
 +
  0014017c: 14400009 bne r2,r0,0x001401a4    {{f/Cond|If Nb of Abilities in List > 0x06}}
 +
  00140180: 34020006 ori r2,r0,0x0006            |{{f/std|}}
 +
  00140184: 2602fffa addiu r2,r16,-0x0006        |{{f/std|abilities - 6}}
 +
  00140188: 3c018016 lui r1,0x8016                |
 +
  0014018c: a4226996 sh r2,0x6996(r1)             |{{f/store|store number of scrollable slots}}
 +
  00140190: 34020006 ori r2,r0,0x0006             |
 +
  00140194: 3c018016 lui r1,0x8016               |
 +
  00140198: a4226994 sh r2,0x6994(r1)             |{{f/store|store 6 number of displayed slots}}
 +
  0014019c: 08050072 j 0x001401c8                |
 +
  001401a0: 00000000 nop                         |
 +
                                            '''Else Nb Of Abilities < 0x06'''
 +
  001401a4: 00501023 subu r2,r2,r16               |{{f/std|}}
 +
  001401a8: 3c018016 lui r1,0x8016               |
 +
  001401ac: a4206996 sh r0,0x6996(r1)             |{{f/store|store number of scrollable slots}}
 +
  001401b0: 3c018016 lui r1,0x8016               |
 +
  001401b4: a4306994 sh r16,0x6994(r1)           |{{f/store|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)         |{{f/adr|load block #}} {{f/std|Currently running thread}}
 +
  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)       |{{f/store|169870}}
 +
  001401e4: 3c018017 lui r1,0x8017           |
 +
  001401e8: 00220821 addu r1,r1,r2           |
 +
  001401ec: ac209874 sw r0,-0x678c(r1)       |{{f/store|169874}}
 +
  001401f0: 3c018017 lui r1,0x8017           |
 +
  001401f4: 00220821 addu r1,r1,r2           |
 +
  001401f8: ac239878 sw r3,-0x6788(r1)       |{{f/store|169878}}
 +
  001401fc: 8fbf0054 lw r31,0x0054(r29)       END
 
  00140200: 8fb60050 lw r22,0x0050(r29)
 
  00140200: 8fb60050 lw r22,0x0050(r29)
 
  00140204: 8fb5004c lw r21,0x004c(r29)
 
  00140204: 8fb5004c lw r21,0x004c(r29)
Line 575: Line 548:
 
  00140220: 03e00008 jr r31
 
  00140220: 03e00008 jr r31
 
  00140224: 00000000 nop
 
  00140224: 00000000 nop
 +
===Notes===
 +
Data at 0x80169266 : 2 halfwords per action menu ID
 +
This routine only uses 0x00
 +
 +
0x80169266              0x00    0x02
 +
-------------------------------------
 +
0x00    Default        0000    0003
 +
0x04    Item Inventory  0001    0003
 +
0x08    Throw          0001    0003
 +
0x12    Math Skill      0000    fffd
 +
0x16    Elemental      0000    fffd
 +
0x20    Blank          0000    0003
 +
0x24    Monster        0000    0003
 +
0x28    Katana          0001    fffd
 +
0x32    Attack          0000    fffd
 +
0x36    Jump            0000    fffd
 +
0x40    Charge          0000    fffd
 +
0x44    Defend          0000    0505
 +
0x48    Equip Change    0605    0524
 +
0x52    Unknown        0505    0505
 +
0x56    Blank          0505    0505
 +
0x60    Unknown        1010    0010
 +
===Return location===
 +
'''Battle.bin'''
 +
0014cf18: [[Call_Inner_Subroutine]]  (via jalr)

Latest revision as of 04:30, 25 December 2024

Runs when a skillset is selected

BATTLE.BIN - Main Skillset/ability loading
---------------------------------------------------------------------------------------
Parameter : r4 = 0x02 - 1st Menu (All Action menus and Math 1st set of skills)
                 0x01 - 2nd Menu for Math skills
                 0x00 - Last Menu for math skill (spell list)

Returns : Nothing

This Routine will : Initialize Lists of Ability data used in menu
                    Fill The lists (via other routines)
                    Set Menu Size and Headers
                    Set Blinking red/grey abilities
---------------------------------------------------------------------------------------
0013fa6c: 3c028017 lui r2,0x8017            |
0013fa70: 8c424048 lw r2,0x4048(r2)         |Pointer to Ability List
0013fa74: 27bdffa8 addiu r29,r29,-0x0058    |
0013fa78: afb20040 sw r18,0x0040(r29)       |
0013fa7c: 3c128015 lui r18,0x8015           |
0013fa80: 8652d08a lh r18,-0x2f76(r18)      |load attacker battle ID 8014d084 - Selected Unit 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       |Pointer to output list "Stock" "Mp" 
0013faa4: 3c018016 lui r1,0x8016            |
0013faa8: ac2269a4 sw r2,0x69a4(r1)         |store skillset ability list pointer
0013faac: 24420148 addiu r2,r2,0x0148       |Pointer to output list "Turns" 
0013fab0: 3c018016 lui r1,0x8016            |
0013fab4: ac2369a8 sw r3,0x69a8(r1)         |store skillset ability list + 0xa4 for MP cost
0013fab8: 3c018016 lui r1,0x8016            |
0013fabc: ac2269ac sw r2,0x69ac(r1)         |Store skillset ability list + 0x0148 for #turns
0013fac0: 0c04b7d0 jal 0x0012df40           |-->0012df40_-_0012df64 Returns Selected unit battle pointer
0013fac4: 0080a821 addu r21,r4,r0           |r21 = PV (number of times gone through menus?)
0013fac8: 0040b021 addu r22,r2,r0           |Pointer to Unit Battle stats
0013facc: 00002821 addu r5,r0,r0            |Initialize counter
0013fad0: 3409ffff ori r9,r0,0xffff         |
0013fad4: 3c028017 lui r2,0x8017            |
0013fad8: 8c423cb8 lw r2,0x3cb8(r2)         |Pointer to menu data 0x80166b10
0013fadc: 340800ff ori r8,r0,0x00ff         |
0013fae0: 84420128 lh r2,0x0128(r2)         |Used Skillset (1 for Primary 2 For Secondary)
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 ID  (based on used skillset)
0013faf4: 3c018017 lui r1,0x8017            |
0013faf8: 00220821 addu r1,r1,r2            |
0013fafc: 90304060 lbu r16,0x4060(r1)       |Load displayed skillset ID  (based on used skillset)
0013fb00: 3c068015 lui r6,0x8015            |
0013fb04: 24c6d264 addiu r6,r6,-0x2d9c      |8014d264
0013fb08: 3c018017 lui r1,0x8017            |
0013fb0c: a030982d sb r16,-0x67d3(r1)       |store skillset at 0x8016982d
                                            @LOOP - Initialize Abillity lists
0013fb10: 3c038017 lui r3,0x8017                |
0013fb14: 8c634048 lw r3,0x4048(r3)             |Pointer to Ability List
0013fb18: 00052040 sll r4,r5,0x01               |counter * 2
0013fb1c: 00831021 addu r2,r4,r3                |Dynamic Pointer to Ability List (Halfword offset)
0013fb20: 00651821 addu r3,r3,r5                |Dynamic Pointer to Ability List (Byte offset)
0013fb24: a4490000 sh r9,0x0000(r2)             |Initialize Ability ID List (0xffff from 0x00 to 0x100)
0013fb28: a06801ec sb r8,0x01ec(r3)             |Initialize MP cost, Consumed Item ID  with 0xff (0x1ec - 0x26c) 
0013fb2c: 3c028017 lui r2,0x8017                |
0013fb30: 8c424048 lw r2,0x4048(r2)             |Pointer to Ability List
0013fb34: 00000000 nop                          |
0013fb38: 00451021 addu r2,r2,r5                |Dynamic Pointer to Ability List (Byte offset)
0013fb3c: a047023e sb r7,0x023e(r2)             |Intialize CT list with 0x01 in ability CT  (0x23e - 0x2be, there is a lot of overlap with some of these.)
0013fb40: 3c028017 lui r2,0x8017                |
0013fb44: 8c424048 lw r2,0x4048(r2)             |Pointer to Ability List
0013fb48: 00000000 nop                          |
0013fb4c: 00822021 addu r4,r4,r2                |Dynamic Pointer to Ability List (Halfword offset)
0013fb50: 00451021 addu r2,r2,r5                |
0013fb54: a48000a4 sh r0,0x00a4(r4)             |clear "stock" "mp" (0xa4 - 0x1a4 Stock/MP)
0013fb58: a4890148 sh r9,0x0148(r4)             |store 0xffff (0x148 - 0x248)
0013fb5c: a0400290 sb r0,0x0290(r2)             |store 0x00 for silence/performance/reflect (0x290 - 0x310)
0013fb60: 3c028017 lui r2,0x8017                |
0013fb64: 8c424048 lw r2,0x4048(r2)             |Pointer to Ability List
0013fb68: 00000000 nop                          |
0013fb6c: 00451021 addu r2,r2,r5                |Dynamic Pointer to Ability List (Byte offset)
0013fb70: a04702e2 sb r7,0x02e2(r2)             |store 0x1 in # turns to complete (0x2e2 - 0x362)
0013fb74: 3c028017 lui r2,0x8017                |
0013fb78: 8c424048 lw r2,0x4048(r2)             |Pointer to Ability List ...and again
0013fb7c: 00000000 nop                          |
0013fb80: 00451021 addu r2,r2,r5                |Dynamic Pointer to Ability List (Byte offset)
0013fb84: a0480334 sb r8,0x0334(r2)             |store CT list = 0xFF
0013fb88: a4c00000 sh r0,0x0000(r6)             |store normal for ability display (0x8014d264 - 0x8014d300), no Unit ID (0x8014d304), and others From 0x8014d264 to 0x8014d364
0013fb8c: 24a50001 addiu r5,r5,0x0001           |Counter + 1
0013fb90: 28a20050 slti r2,r5,0x0050            |Check limit
0013fb94: 1440ffde bne r2,r0,0x0013fb10     Λ Loop 80 times
0013fb98: 24c60002 addiu r6,r6,0x0002           |Dynamic pointer to Ability display + 2
                                            Set end of lists
0013fb9c: 3c028017 lui r2,0x8017            |
0013fba0: 8c424048 lw r2,0x4048(r2)         |Pointer to Ability List
0013fba4: 340300ff ori r3,r0,0x00ff         |
0013fba8: a043023c sb r3,0x023c(r2)         |End MP/Stock List  it is already 0xff…
0013fbac: 3c028017 lui r2,0x8017            |
0013fbb0: 8c424048 lw r2,0x4048(r2)         |Pointer to Ability List
0013fbb4: 00000000 nop                      |
0013fbb8: a043028e sb r3,0x028e(r2)         |End CT List  it is already 0xff…
0013fbbc: 3c028017 lui r2,0x8017            |
0013fbc0: 8c424048 lw r2,0x4048(r2)         |Pointer to Ability List
0013fbc4: 00000000 nop                      |
0013fbc8: a04302e0 sb r3,0x02e0(r2)         |End Silence Reflect Perform list
0013fbcc: 3c028017 lui r2,0x8017            |
0013fbd0: 8c424048 lw r2,0x4048(r2)         |Pointer to Ability List
0013fbd4: 00000000 nop                      |
0013fbd8: a0430332 sb r3,0x0332(r2)         |End Turn list
0013fbdc: 3c028017 lui r2,0x8017            |
0013fbe0: 8c424048 lw r2,0x4048(r2)         |Pointer to Ability List

**Section 1 - Load ability-relevant data**
                                        ------- Action Menu 0x00 - Default -----------
0013fbe4: 16200014 bne r17,r0,0x0013fc38    #If Action Menu = 0x00
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)             |Pointer to Ability List
0013fbf8: 02002821 addu r5,r16,r0               |r5 = skillset ID
0013fbfc: afa00014 sw r0,0x0014(r29)            |
0013fc00: 24c701ec addiu r7,r6,0x01ec           |Pointer to MP Cost/ Stock List
0013fc04: 24c2023e addiu r2,r6,0x023e           |Pointer to Ability CT
0013fc08: afa20010 sw r2,0x0010(r29)            |Send Ability CT pointer through stack
0013fc0c: 24c20290 addiu r2,r6,0x0290           | Pointer to Silence/persevere/Reflect
0013fc10: afa20018 sw r2,0x0018(r29)            |Send silence/performance/reflect pointer  through stack
0013fc14: 24c202e2 addiu r2,r6,0x02e2           | Pointer to Nb of Turns List
0013fc18: 0c0605f0 jal 0x001817c0               |-->Load_ability_data_for_skillset Fill List and returns Nb of usable Abilities (known - sword - materia - frog)
0013fc1c: afa2001c sw r2,0x001c(r29)            |Send Nb of Turns pointer through stack
0013fc20: 3c058017 lui r5,0x8017                |
0013fc24: 8ca54048 lw r5,0x4048(r5)             |Pointer to Ability List
0013fc28: 34060050 ori r6,r0,0x0050             |Size of data to transfer 0x50
0013fc2c: 24a40334 addiu r4,r5,0x0334           | Pointer to Ability CT
0013fc30: 0c052fd5 jal 0x0014bf54               |-->Copy 0x50 Bytes from r5 to r4
0013fc34: 24a5023e addiu r5,r5,0x023e           |Pointer to Ability CT

                                        ------- Action Menu 0x01 - Item inventory -----------
0013fc38: 34140001 ori r20,r0,0x0001        |
0013fc3c: 16340007 bne r17,r20,0x0013fc5c   #If Action Menu = 0x01
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)             |Pointer to Ability List
0013fc50: 02002821 addu r5,r16,r0               |
0013fc54: 0c0606dc jal 0x00181b70               |-->Item_Ability_Loading
0013fc58: 24c601ec addiu r6,r6,0x01ec           |Item Used List per Ability ID (don't parse other arguments through stack)

                                        ------- Action Menu0x02 - Weapon inventory -----------
0013fc5c: 16330008 bne r17,r19,0x0013fc80   #If Action Menu = 0x02
0013fc60: 34020003 ori r2,r0,0x0003             |
0013fc64: 02402021 addu r4,r18,r0               |r4 = unit ID
0013fc68: 3c068017 lui r6,0x8017                |
0013fc6c: 8cc64048 lw r6,0x4048(r6)             |Pointer to Ability List
0013fc70: 02002821 addu r5,r16,r0               |skillset
0013fc74: 0c06072e jal 0x00181cb8               |-->Throw Ability & Item Loading
0013fc78: 24c601ec addiu r6,r6,0x01ec           |Item Used list per Item ID
0013fc7c: 34020003 ori r2,r0,0x0003             |math skill check

                                        ------- Action Menu 0x03 - Mathematics  -----------
0013fc80: 16220014 bne r17,r2,0x0013fcd4    #If Action Menu = 0x03
0013fc84: 00000000 nop                          |
0013fc88: 16b30005 bne r21,r19,0x0013fca0       #If PV = 0x02 : Load 1st set of Math abilities
0013fc8c: 02402021 addu r4,r18,r0                   |r4 = attacker ID
0013fc90: 3c068017 lui r6,0x8017                    |
0013fc94: 8cc64048 lw r6,0x4048(r6)                 |Pointer to Ability List
0013fc98: 0c0607bc jal 0x00181ef0                   |-->Math_Skill_Ability_Display Checks for primary menu
0013fc9c: 02002821 addu r5,r16,r0                   |r5 = skillset ID
0013fca0: 16b40005 bne r21,r20,0x0013fcb8       #if PV = 0x01 : Load 2nd set of Math abilities
0013fca4: 02402021 addu r4,r18,r0                   |r4 = attacker ID
0013fca8: 3c068017 lui r6,0x8017                    |
0013fcac: 8cc64048 lw r6,0x4048(r6)                 |Pointer to Ability List
0013fcb0: 0c0607c5 jal 0x00181f14                   |-->Math_Skill_Ability_Display Checks for secondary menu
0013fcb4: 02002821 addu r5,r16,r0                   |Skillset ID
0013fcb8: 16a00007 bne r21,r0,0x0013fcd8        #if PV = 0x00 : Load Math spell list
0013fcbc: 34020006 ori r2,r0,0x0006                 |
0013fcc0: 02402021 addu r4,r18,r0                   |r4 = attacker ID
0013fcc4: 3c068017 lui r6,0x8017                    |
0013fcc8: 8cc64048 lw r6,0x4048(r6)                 |Pointer to Ability List
0013fccc: 0c06081a jal 0x00182068                   |-->Math_Skill_ability_loading Loop through Valid skillset and seek known Spells
0013fcd0: 02002821 addu r5,r16,r0                   |Skillset ID

                                        ------- Action Menu 0x06 Monsters / Frog  -----------
0013fcd4: 34020006 ori r2,r0,0x0006         |
0013fcd8: 1622000a bne r17,r2,0x0013fd04    #If Action Menu = 0x06
0013fcdc: 34020007 ori r2,r0,0x0007             |
0013fce0: 02402021 addu r4,r18,r0               |Unit ID
0013fce4: 02002821 addu r5,r16,r0               |Skillset ID
0013fce8: 3c068017 lui r6,0x8017                |
0013fcec: 8cc64048 lw r6,0x4048(r6)             |Pointer to Ability List
0013fcf0: 00003821 addu r7,r0,r0                |r7 = 0
0013fcf4: 24c20290 addiu r2,r6,0x0290           | Pointer to Silence/persevere/Reflect
0013fcf8: 0c0608b3 jal 0x001822cc               |-->Monster_skill,_frog_attack_ability_loading
0013fcfc: afa20010 sw r2,0x0010(r29)            |send silence/reflectable/performance pointer through stack
0013fd00: 34020007 ori r2,r0,0x0007             |

                                        ------- Action Menu 0x07 Katana Inventory -----------
0013fd04: 16220008 bne r17,r2,0x0013fd28    #If Action Menu = 0x07
0013fd08: 3402000a ori r2,r0,0x000a             |
0013fd0c: 02402021 addu r4,r18,r0               |Unit ID
0013fd10: 3c068017 lui r6,0x8017                |
0013fd14: 8cc64048 lw r6,0x4048(r6)             |Pointer to Ability List
0013fd18: 02002821 addu r5,r16,r0               |Skillset ID
0013fd1c: 0c060999 jal 0x00182664               |-->Draw_Out
0013fd20: 24c601ec addiu r6,r6,0x01ec           |Pointer to MP Cost/ Stock List
0013fd24: 3402000a ori r2,r0,0x000a             |

                                        ------- Action Menu 0x0A - Aim -----------
0013fd28: 16220010 bne r17,r2,0x0013fd6c    #If Action Menu = 0x0A
0013fd2c: 34020003 ori r2,r0,0x0003             |
0013fd30: 02402021 addu r4,r18,r0               |Unit ID
0013fd34: 3c068017 lui r6,0x8017                |
0013fd38: 8cc64048 lw r6,0x4048(r6)             |Pointer to Ability List
0013fd3c: 02002821 addu r5,r16,r0               |
0013fd40: 24c701ec addiu r7,r6,0x01ec           |Raw Ability CT Use MP list to store charge CT ?
0013fd44: 24c202e2 addiu r2,r6,0x02e2           |Turns
0013fd48: 0c0609ed jal 0x001827b4               |-->Charge_Skillset_Loading
0013fd4c: afa20010 sw r2,0x0010(r29)            # turns in stack + 0x10
0013fd50: 3c058017 lui r5,0x8017                |
0013fd54: 8ca54048 lw r5,0x4048(r5)             |Ability ID list
0013fd58: 34060050 ori r6,r0,0x0050             |r6 = 0x80
0013fd5c: 24a40334 addiu r4,r5,0x0334           |Ability CT?
0013fd60: 0c052fd5 jal 0x0014bf54               |-->Copy 0x50 Bytes from r5 to r4
0013fd64: 24a501ec addiu r5,r5,0x01ec           |Raw ability CT
0013fd68: 34020003 ori r2,r0,0x0003             |

**2nd Section -  Set Usabilities / Menu data **
                                        ------ POST ACTION MENU MAIN SECTION ----
0013fd6c: 12220002 beq r17,r2,0x0013fd78    #If Action Menu is not Mathematics
0013fd70: 341200ac ori r18,r0,0x00ac        |default r18 to 0xac (menu type flags?)
0013fd74: 0000a821 addu r21,r0,r0               |r21 = 0 if not math skill (Last Math skill menu has already r21 to 0x00)
0013fd78: 34020003 ori r2,r0,0x0003         |
0013fd7c: 3c018016 lui r1,0x8016            |
0013fd80: a42269a0 sh r2,0x69a0(r1)         |store stock/mp/turns display (initialised)
0013fd84: 3c018016 lui r1,0x8016            |
0013fd88: a42269a2 sh r2,0x69a2(r1)         |store stock/mp/turns display (initialised)
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 ID*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 (if action menu calls inventory or not?)  * details in notes
0013fdbc: 34020001 ori r2,r0,0x0001         |
0013fdc0: 14620048 bne r3,r2,0x0013fee4     #If used Action Menu Call inventory (r3 = 0x01)
0013fdc4: 00003021 addu r6,r0,r0            |Defaut Menu dimension/Tags

                                            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 0x0013fa00               |-->0013fa00_-_0013fa34
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               # of abilities
0013fde8: 24a40148 addiu r4,r5,0x0148           |r4 = Turns
0013fdec: 0c04fe8e jal 0x0013fa38               |-->0013fa38_-_0013fa68 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,0x0013fe60          #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)                 |load Ability ID list
                                                    @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,0x0013fe48                 #If No items
0013fe3c: 00000000 nop                                      |
0013fe40: 0804ff93 j 0x0013fe4c                             |
0013fe44: a4870000 sh r7,0x0000(r4)                         |store grayed out ability
                                                        Else : if item quantity != 0
0013fe48: 34060001 ori r6,r0,0x0001                         |set ability usable?
0013fe4c: 24840002 addiu r4,r4,0x0002                   |count another availability if item is usable
0013fe50: 24a50001 addiu r5,r5,0x0001                   |counter + 1
0013fe54: 00b0102a slt r2,r5,r16                        |
0013fe58: 1440ffee bne r2,r0,0x0013fe14             Λ Loop - do for all Items in list
0013fe5c: 24630002 addiu r3,r3,0x0002                   |next ability ID
0013fe60: 10c00003 beq r6,r0,0x0013fe70         #branch if there is consumable items
0013fe64: 34070007 ori r7,r0,0x0007             |Control Value = 0x07
0013fe68: 0804ffa7 j 0x0013fe9c                     |
0013fe6c: 2652fffc addiu r18,r18,0xfffc             |if items are available, r18 = 0xa8
                                                Else : if no items with quantity > 0 found
0013fe70: 02003021 addu r6,r16,r0                   |
0013fe74: 34120094 ori r18,r0,0x0094                |if no items can be found, r18 = 0x94
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 0x0013fa38                   |-->0013fa38_-_0013fa68
0013fe94: 24a502e2 addiu r5,r5,0x02e2               |r5 = 01 data
0013fe98: 34070008 ori r7,r0,0x0008                 |Control value = 0x08
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,0x00140048        #branch if not Draw out
0013fed0: 34060011 ori r6,r0,0x0011             |Item/Throw
0013fed4: 08050012 j 0x00140048                     >>Jump
0013fed8: 34060017 ori r6,r0,0x0017                 |Katana
                                                -- 2 shitty lines, reached by backward branching --
0013fedc: 0804ffd5 j 0x0013ff54                 >>Skip Next Section
0013fee0: 34060001 ori r6,r0,0x0001             |Dimension Tag if at least one Ability in list has a MP cost

                                            Not Item/throw/draw out 
0013fee4: 00008021 addu r16,r0,r0               |Initialize counter
0013fee8: 3404ffff ori r4,r0,0xffff             |
0013feec: 3c038017 lui r3,0x8017                |
0013fef0: 8c634048 lw r3,0x4048(r3)             |Pointer to Ability List
                                                @LOOP - Count listed Abilities
0013fef4: 00000000 nop                              |
0013fef8: 94620000 lhu r2,0x0000(r3)                |Ability ID
0013fefc: 00000000 nop                              |
0013ff00: 10440005 beq r2,r4,0x0013ff18             #if ID = 0xfff : Exit Loop (end of listed abilities)
0013ff04: 00000000 nop                              |
0013ff08: 26100001 addiu r16,r16,0x0001             |Counter + 1
0013ff0c: 2a020040 slti r2,r16,0x0040               |Check list limit
0013ff10: 1440fff8 bne r2,r0,0x0013fef4         Λ Loop until last Ability or end of list
0013ff14: 24630002 addiu r3,r3,0x0002               |Dynamic list pointer (halfword offset)

                                                Defaut Action Menu (0x00)
0013ff18: 1620000f bne r17,r0,0x0013ff58        #if Used Action Menu = Default
0013ff1c: 34020003 ori r2,r0,0x0003                 |
0013ff20: 1a00000d blez r16,0x0013ff58              #If There is no Ability in List : Branch to  Next Section
0013ff24: 00002821 addu r5,r0,r0                    |Initialize counter
0013ff28: 3c038017 lui r3,0x8017                        |
0013ff2c: 8c634048 lw r3,0x4048(r3)                 |Pointer to Ability List
0013ff30: 00000000 nop                              |
0013ff34: 00651021 addu r2,r3,r5                    |Dynamic Pointer to Ability List (Byte offset)
                                                    @Loop - MP Cost
0013ff38: 904201ec lbu r2,0x01ec(r2)                    |load MP cost
0013ff3c: 00000000 nop                                  |
0013ff40: 1440ffe6 bne r2,r0,0x0013fedc                 #Branch back if ability has MP cost (set custom menu dimensions/tags) and exit loop Seriously ?
0013ff44: 24a50001 addiu r5,r5,0x0001                   |counter++
0013ff48: 00b0102a slt r2,r5,r16                        |set if yet to search all abilities
0013ff4c: 1440fffa bne r2,r0,0x0013ff38             Λ Loop (all listed abilities)
0013ff50: 00651021 addu r2,r3,r5                        |Dynamic Pointer to Ability List (Byte offset)
0013ff54: 34020003 ori r2,r0,0x0003                     |

                                                Mathematics Action Menu (0x03)
0013ff58: 1622000a bne r17,r2,0x0013ff84        #If Action Menu is Mathematics
0013ff5c: 00000000 nop                              |
0013ff60: 1aa00008 blez r21,0x0013ff84              #If Not Loading Spell list (Preset value <> 0x00) :  Skip Section
0013ff64: 34020002 ori r2,r0,0x0002                     |
0013ff68: 34120088 ori r18,r0,0x0088                    |if math skill, r18 = 0x88
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 0x00140040                         |
0013ff80: 34070009 ori r7,r0,0x0009                     |jump down, Set control value = 0x09

                                                Not Mathematics (Item - Throw - Draw Out - Default)
0013ff84: 10c00019 beq r6,r0,0x0013ffec         #If Ability Has a MP cost
0013ff88: 00000000 nop                              |
0013ff8c: 16200018 bne r17,r0,0x0013fff0            #If Not Defaut Action Menu :  Skip Section
0013ff90: 02003021 addu r6,r16,r0                   |For Each Ability
0013ff94: 3c058017 lui r5,0x8017                    |
0013ff98: 8ca54048 lw r5,0x4048(r5)                 |Pointer to Ability List
0013ff9c: 2652fff8 addiu r18,r18,-0x0008            |if default menu, r18 = 0xa4 (menu width includes MP)
0013ffa0: 24a400a4 addiu r4,r5,0x00a4               |Pointer MP List
0013ffa4: 0c04fe80 jal 0x0013fa00                   |-->Set MP Values Copy data from r5 (byte) to r4(halfwords)
0013ffa8: 24a501ec addiu r5,r5,0x01ec               |Pointer MP List
0013ffac: 3c058017 lui r5,0x8017                    |
0013ffb0: 8ca54048 lw r5,0x4048(r5)                 |Pointer to Ability List
0013ffb4: 02003021 addu r6,r16,r0                   |For Each Ability
0013ffb8: 24a40148 addiu r4,r5,0x0148               |Pointer Turn List
0013ffbc: 0c04fe8e jal 0x0013fa38                   |-->Transfer Turns Copy data from r5 (byte) to r4(halfwords)
0013ffc0: 24a502e2 addiu r5,r5,0x02e2               |Pointer Turn List
0013ffc4: 34070006 ori r7,r0,0x0006                 |menu header type = "Ability"     "Ref" "MP" "Turns"
0013ffc8: 3c048016 lui r4,0x8016                    |
0013ffcc: 2484699a addiu r4,r4,0x699a               |8016699a
0013ffd0: 94820000 lhu r2,0x0000(r4)                |load "MP" header display location
0013ffd4: 3c038016 lui r3,0x8016                    |
0013ffd8: 9463699c lhu r3,0x699c(r3)                |load "turns" header display
0013ffdc: 2442fff8 addiu r2,r2,0xfff8               |r2 -= 0x08
0013ffe0: 2463fff8 addiu r3,r3,0xfff8               |r3 -= 0x08
0013ffe4: 0805000e j 0x00140038                     |
0013ffe8: a4820000 sh r2,0x0000(r4)                 |store new "MP" header display location
                                                Else : Ability Without MP Cost (Or not default action menu)
0013ffec: 02003021 addu r6,r16,r0                   |
0013fff0: 3c058017 lui r5,0x8017                    |
0013fff4: 8ca54048 lw r5,0x4048(r5)                 |
0013fff8: 34120094 ori r18,r0,0x0094                |if menu cannot not use items, is not default, or isn't math, r18 = 0x94
0013fffc: 24a400a4 addiu r4,r5,0x00a4               |Pointer MP/Stock List
00140000: 0c04fe8e jal 0x0013fa38                   |-->Transfer Turns Copy data from r5 (byte) to r4(halfwords)
00140004: 24a502e2 addiu r5,r5,0x02e2               |Pointer MP/Stock 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
00140038: 3c018016 lui r1,0x8016                |
0014003c: a423699c sh r3,0x699c(r1)             |store new display location
00140040: 34097000 ori r9,r0,0x7000         |Default 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 menu type? 3 times. 0x94 means no abilities available?
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,0x0014012c      #If There is abilities in the list
00140068: a44600ee sh r6,0x00ee(r2)         |store skillset type?
0014006c: 34080008 ori r8,r0,0x0008             |blinking red
00140070: 340a0006 ori r10,r0,0x0006            |
00140074: 3c068017 lui r6,0x8017                |
00140078: 8cc64048 lw r6,0x4048(r6)             |Pointer to Ability List
0014007c: 3c078015 lui r7,0x8015                |
00140080: 24e7d264 addiu r7,r7,0xd264           |Pointer to Ability Display
00140084: 00c02021 addu r4,r6,r0                |Pointer to Ability List
                                                @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 (r9 is 0x7000)
00140094: 1620000e bne r17,r0,0x001400d0            #If Action Menu ID is Default (0x00)
00140098: a4c20000 sh r2,0x0000(r6)                 |store ability with type flags
0014009c: 96c2002c lhu r2,0x002c(r22)                   |load Unit 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,0x001400c8                   #If unit has not enough MP
001400b0: 00000000 nop                                      |
001400b4: 90820334 lbu r2,0x0334(r4)                        |Load CT
001400b8: 00000000 nop                                      |
001400bc: 10400002 beq r2,r0,0x001400c8                     #If There is a CT
001400c0: 00000000 nop                                          |
001400c4: a4e80000 sh r8,0x0000(r7)                             |Set ability blinking red
001400c8: 12200003 beq r17,r0,0x001400d8                #Avoid Monster check and go to monster-default section could just be a jump…
001400cc: 00000000 nop                                      |
001400d0: 162a0010 bne r17,r10,0x00140114           #If Action Menu is Monster (0x06)   (Or Default)
001400d4: 00000000 nop                                  |
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,0x00140114                 #If Affected by silance
001400e8: 00000000 nop                                      |
001400ec: 90820334 lbu r2,0x0334(r4)                        |Load CT
001400f0: 00000000 nop                                      |
001400f4: 10400007 beq r2,r0,0x00140114                     #If no CT : Avoid blinking red
001400f8: 00000000 nop                                          |
001400fc: 92c20059 lbu r2,0x0059(r22)                       |Load current status 2
00140100: 00000000 nop                                      |
00140104: 30420008 andi r2,r2,0x0008                        |
00140108: 10400002 beq r2,r0,0x00140114                     #If Unit has Silence
0014010c: 00000000 nop                                          |
00140110: a4e80000 sh r8,0x0000(r7)                             |set skill blinking red (0x08)
00140114: 24e70002 addiu r7,r7,0x0002               |Dynamic Pointer to Ability display (Halfword offset)
00140118: 24840001 addiu r4,r4,0x0001               |Dynamic Pointer to Ability List (Byte offset)
0014011c: 24a50001 addiu r5,r5,0x0001               |Loop counter + 1
00140120: 00b0102a slt r2,r5,r16                    |
00140124: 1440ffd8 bne r2,r0,0x00140088         Λ do for all abilities
00140128: 24c60002 addiu r6,r6,0x0002               |Dynamic Pointer to Ability List (Halfword offset)
0014012c: 1600000e bne r16,r0,0x00140168    #If There is no Ability in list
00140130: 34037000 ori r3,r0,0x7000             |
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)             |Pointer to Ability List
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 data
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,0x001401a4     #If Nb of Abilities in List > 0x06
00140180: 34020006 ori r2,r0,0x0006             |
00140184: 2602fffa addiu r2,r16,-0x0006         |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 0x001401c8                 |
001401a0: 00000000 nop                          |
                                            Else Nb Of Abilities < 0x06
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 # Currently running thread
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)       END
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

Notes

Data at 0x80169266 : 2 halfwords per action menu ID
This routine only uses 0x00

0x80169266               0x00    0x02
-------------------------------------
0x00     Default         0000    0003
0x04     Item Inventory  0001    0003
0x08     Throw           0001    0003
0x12     Math Skill      0000    fffd
0x16     Elemental       0000    fffd
0x20     Blank           0000    0003
0x24     Monster         0000    0003
0x28     Katana          0001    fffd
0x32     Attack          0000    fffd
0x36     Jump            0000    fffd
0x40     Charge          0000    fffd
0x44     Defend          0000    0505
0x48     Equip Change    0605    0524
0x52     Unknown         0505    0505
0x56     Blank           0505    0505
0x60     Unknown         1010    0010

Return location

Battle.bin
0014cf18: Call_Inner_Subroutine  (via jalr)