Difference between revisions of "Skillset Loading"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
(Created page with " 001817c0: 27bdfed0 addiu r29,r29,0xfed0 001817c4: afa400b0 sw r4,0x00b0(r29) 001817c8: 8fa400b0 lw r4,0x00b0(r29) 001817cc: afb40118 sw r20,0x0118(r29) 001817d0: 8fb40140...")
 
Line 1: Line 1:
  001817c0: 27bdfed0 addiu r29,r29,0xfed0
+
  Skillset Loading?
  001817c4: afa400b0 sw r4,0x00b0(r29)
+
r6 = action menu byte
  001817c8: 8fa400b0 lw r4,0x00b0(r29)
+
00181584: 27bdfe90 addiu r29,r29,0xfe90
  001817cc: afb40118 sw r20,0x0118(r29)
+
  00181588: afb00160 sw r16,0x0160(r29)
  001817d0: 8fb40140 lw r20,0x0140(r29)
+
  0018158c: 00808021 addu r16,r4,r0 unit ID
  001817d4: afb20110 sw r18,0x0110(r29)
+
  00181590: 001010c0 sll r2,r16,0x03
  001817d8: 8fb20148 lw r18,0x0148(r29)
+
00181594: 00501023 subu r2,r2,r16
  001817dc: afb1010c sw r17,0x010c(r29)
+
  00181598: 00021180 sll r2,r2,0x06
  001817e0: 8fb1014c lw r17,0x014c(r29)
+
  0018159c: afbf016c sw r31,0x016c(r29)
  001817e4: afbe0128 sw r30,0x0128(r29)
+
  001815a0: afb20168 sw r18,0x0168(r29)
001817e8: 0000f021 addu r30,r0,r0
+
  001815a4: afb10164 sw r17,0x0164(r29)
  001817ec: afbf012c sw r31,0x012c(r29)
+
  001815a8: 3c018019 lui r1,0x8019
  001817f0: afb70124 sw r23,0x0124(r29)
+
  001815ac: 00220821 addu r1,r1,r2
  001817f4: afb60120 sw r22,0x0120(r29)
+
  001815b0: 90220926 lbu r2,0x0926(r1) load current status 3
001817f8: afb5011c sw r21,0x011c(r29)
+
  001815b4: 00000000 nop
  001817fc: afb30114 sw r19,0x0114(r29)
+
  001815b8: 30420002 andi r2,r2,0x0002
  00181800: afb00108 sw r16,0x0108(r29)
+
  001815bc: 10400009 beq r2,r0,0x 001815e4 branch if not frog
00181804: afa600c0 sw r6,0x00c0(r29)
+
  001815c0: 30c300ff andi r3,r6,0x00ff r3 = action menu byte
  00181808: afa000e0 sw r0,0x00e0(r29)
+
  001815c4: 10600007 beq r3,r0,0x 001815e4 branch if default
  0018180c: afa000e8 sw r0,0x00e8(r29)
+
  001815c8: 34020006 ori r2,r0,0x0006
  00181810: afa000f0 sw r0,0x00f0(r29)
+
  001815cc: 10620005 beq r3,r2,0x 001815e4 branch if monster
  00181814: afa000f8 sw r0,0x00f8(r29)
+
  001815d0: 34020008 ori r2,r0,0x0008
  00181818: afa00100 sw r0,0x0100(r29)
+
  001815d4: 10620003 beq r3,r2,0x 001815e4 branch if attack
  0018181c: afa700c8 sw r7,0x00c8(r29)
+
  001815d8: 34020005 ori r2,r0,0x0005
  00181820: 0c060435 jal 0x 001810d4 load unit data (r2)
+
  001815dc: 14620049 bne r3,r2,0x 00181704 branch if not blank
  00181824: a3a500b8 sb r5,0x00b8(r29) store primary skillset
+
  001815e0: 00001021 addu r2,r0,r0
  00181828: 00408021 addu r16,r2,r0
+
  001815e4: 2c62000b sltiu r2,r3,0x000b set if action menu is < defend, equip change
  0018182c: 120000c3 beq r16,r0,0x 00181b3c
+
  001815e8: 10400044 beq r2,r0,0x 001816fc
  00181830: 00001021 addu r2,r0,r0
+
  001815ec: 00031080 sll r2,r3,0x02
  00181834: 9202005a lbu r2,0x005a(r16) load statii
+
001815f0: 3c018017 lui r1,0x8017
  00181838: 00000000 nop
+
001815f4: 00220821 addu r1,r1,r2
  0018183c: 30420002 andi r2,r2,0x0002
+
  001815f8: 8c224144 lw r2,0x4144(r1)
00181840: 10400003 beq r2,r0,0x 00181850 branch if not frog
+
  001815fc: 00000000 nop
  00181844: 00000000 nop
+
  00181600: 00400008 jr r2
  00181848: 34090001 ori r9,r0,0x0001
+
  00181604: 00000000 nop
0018184c: afa90100 sw r9,0x0100(r29)
+
   
00181850: 92020090 lbu r2,0x0090(r16) load support 2
+
00174144: 80181608 lb r24,0x1608(r0) default
00181854: 00000000 nop
+
00174148: 80181640 lb r24,0x1640(r0) item
00181858: 30420080 andi r2,r2,0x0080
+
0017414c: 80181658 lb r24,0x1658(r0) weapon inv.
0018185c: 10400003 beq r2,r0,0x 0018186c branch if not half of MP
+
00174150: 80181670 lb r24,0x1670(r0) math skill
00181860: 00000000 nop
+
00174154: 801816b8 lb r24,0x16b8(r0) Elemental
00181864: 34080001 ori r8,r0,0x0001
+
00174158: 801816fc lb r24,0x16fc(r0) blank
00181868: afa800f8 sw r8,0x00f8(r29)
+
0017415c: 801816fc lb r24,0x16fc(r0) monster
0018186c: 92030092 lbu r3,0x0092(r16) load support 4
+
00174160: 801816cc lb r24,0x16cc(r0) katana inv.
  00181870: 00000000 nop
+
00174164: 801816fc lb r24,0x16fc(r0) attack
  00181874: 30620004 andi r2,r3,0x0004
+
00174168: 801816fc lb r24,0x16fc(r0) jump
  00181878: 10400003 beq r2,r0,0x 00181888 branch if not non-charge
+
0017416c: 801816e4 lb r24,0x16e4(r0) charge
  0018187c: 34090002 ori r9,r0,0x0002
+
defend and equip change hardcoded in routine
  00181880: 08060626 j 0x 00181898
+
 
  00181884: afa900f0 sw r9,0x00f0(r29)
+
  Default
  00181888: 30620008 andi r2,r3,0x0008
+
  00181608: 02002021 addu r4,r16,r0 unit ID
  0018188c: 10400002 beq r2,r0,0x 00181898 branch if not short charge
+
  0018160c: 30a500ff andi r5,r5,0x00ff r5 = skillset
  00181890: 34080001 ori r8,r0,0x0001
+
  00181610: 27a60078 addiu r6,r29,0x0078
  00181894: afa800f0 sw r8,0x00f0(r29)
+
  00181614: 27a20118 addiu r2,r29,0x0118
  00181898: 27a40010 addiu r4,r29,0x0010
+
  00181618: afa20010 sw r2,0x0010(r29)
  0018189c: 0c060dc3 jal 0x 0018370c Calculate AT list
+
  0018161c: 27a20130 addiu r2,r29,0x0130
  001818a0: 00002821 addu r5,r0,r0
+
  00181620: afa2 0018 sw r2,0x 0018(r29)
  001818a4: 92030184 lbu r3,0x0184(r16) load equipped flags
+
  00181624: 27a20148 addiu r2,r29,0x0148
  001818a8: 00000000 nop
+
  00181628: 27a70100 addiu r7,r29,0x0100
  001818ac: 30620004 andi r2,r3,0x0004
+
  0018162c: afa00014 sw r0,0x0014(r29)
  001818b0: 10400003 beq r2,r0,0x 001818c0 branch if materia blade not equipped
+
  00181630: 0c0605f0 jal 0x 001817c0 Skillset Loading
  001818b4: 30620008 andi r2,r3,0x0008
+
  00181634: afa2001c sw r2,0x001c(r29)
  001818b8: 34090001 ori r9,r0,0x0001
+
  00181638: 080605c1 j 0x 00181704
  001818bc: afa900e0 sw r9,0x00e0(r29)
+
  0018163c: 00000000 nop
001818c0: 10400003 beq r2,r0,0x 001818d0 branch if sword not equipped
+
 
  001818c4: 00000000 nop
+
Item
  001818c8: 34080001 ori r8,r0,0x0001
+
  00181640: 02002021 addu r4,r16,r0
  001818cc: afa800e8 sw r8,0x00e8(r29)
+
  00181644: 30a500ff andi r5,r5,0x00ff
  001818d0: 92020006 lbu r2,0x0006(r16) load gender
+
  00181648: 0c0606e5 jal 0x 00181b94
  001818d4: 00000000 nop
+
  0018164c: 27a60020 addiu r6,r29,0x0020
001818d8: 30420020 andi r2,r2,0x0020
+
  00181650: 080605c1 j 0x 00181704
  001818dc: 14400016 bne r2,r0,0x 00181938 branch if not human
+
  00181654: 00000000 nop
001818e0: 00000000 nop
+
 
  001818e4: 93a900b8 lbu r9,0x00b8(r29) load primary skillset
+
  Weapon Inventory
  001818e8: 00000000 nop
+
00181658: 02002021 addu r4,r16,r0
  001818ec: 2522fffb addiu r2,r9,0xfffb primary skillset - 5
+
  0018165c: 30a500ff andi r5,r5,0x00ff
  001818f0: 304200ff andi r2,r2,0x00ff
+
  00181660: 0c060737 jal 0x 00181cdc find number of throwable items
  001818f4: 2c420013 sltiu r2,r2,0x0013
+
  00181664: 27a60020 addiu r6,r29,0x0020
  001818f8: 10400004 beq r2,r0,0x 0018190c branch if not a generic skillset
+
  00181668: 080605c1 j 0x 00181704 jump to end
  001818fc: 00000000 nop
+
0018166c: 00000000 nop r2 = number of throwable items + 0x100
  00181900: 93a200b8 lbu r2,0x00b8(r29) load primary skillset
+
 
  00181904: 0806064f j 0x 0018193c
+
  Math Skill
  00181908: 2445fffb addiu r5,r2,0xfffb
+
00181670: 02002021 addu r4,r16,r0
  0018190c: 92020012 lbu r2,0x0012(r16) load primary skillset
+
  00181674: 30b200ff andi r18,r5,0x00ff
  00181910: 93a300b8 lbu r3,0x00b8(r29)
+
  00181678: 02402821 addu r5,r18,r0
  00181914: 00000000 nop
+
  0018167c: 27b10078 addiu r17,r29,0x0078
  00181918: 10620005 beq r3,r2,0x 00181930 branch if loaded skillset = primary skillset
+
  00181680: 0c0607bc jal 0x 00181ef0
  0018191c: 00002821 addu r5,r0,r0
+
00181684: 02203021 addu r6,r17,r0
  00181920: 92020162 lbu r2,0x0162(r16) load special skillset
+
  00181688: 1040001e beq r2,r0,0x 00181704
  00181924: 00000000 nop
+
  0018168c: 02002021 addu r4,r16,r0
  00181928: 14620003 bne r3,r2,0x 00181938 branch if not ??
+
  00181690: 02402821 addu r5,r18,r0
  0018192c: 00000000 nop
+
  00181694: 0c0607c5 jal 0x 00181f14
  00181930: 08060650 j 0x 00181940
+
  00181698: 02203021 addu r6,r17,r0
  00181934: 2402ffff addiu r2,r0,0xffff
+
  0018169c: 10400019 beq r2,r0,0x 00181704
  00181938: 2405ffff addiu r5,r0,0xffff
+
  001816a0: 02002021 addu r4,r16,r0
  0018193c: 2402ffff addiu r2,r0,0xffff
+
  001816a4: 02402821 addu r5,r18,r0
  00181940: 14a20004 bne r5,r2,0x 00181954 branch if ???
+
  001816a8: 0c06081a jal 0x 00182068
  00181944: 3c0800ff lui r8,0x00ff
+
  001816ac: 02203021 addu r6,r17,r0
00181948: 3508ffff ori r8,r8,0xffff
+
  001816b0: 080605c1 j 0x 00181704
  0018194c: 08060658 j 0x 00181960
+
  001816b4: 00000000 nop
  00181950: afa800d0 sw r8,0x00d0(r29)
+
 
  00181954: 0c017880 jal 0x0005e200 get known abilities
+
Elemental
00181958: 02002021 addu r4,r16,r0
+
  001816b8: 02002021 addu r4,r16,r0
  0018195c: afa200d0 sw r2,0x00d0(r29) store known abilities? (fffec0)
+
001816bc: 0c060873 jal 0x 001821cc
  00181960: 00009821 addu r19,r0,r0
+
  001816c0: 30a500ff andi r5,r5,0x00ff
  00181964: 03d1b821 addu r23,r30,r17
+
  001816c4: 080605c1 j 0x 00181704
  00181968: 03d2b021 addu r22,r30,r18
+
  001816c8: 3042ffff andi r2,r2,0xffff
  0018196c: 8fa900c8 lw r9,0x00c8(r29)
+
  001816cc: 02002021 addu r4,r16,r0
  00181970: 03d4a821 addu r21,r30,r20
+
  001816d0: 30a500ff andi r5,r5,0x00ff
  00181974: 03c9a021 addu r20,r30,r9
+
  001816d4: 0c0609a2 jal 0x 00182688
  00181978: 3c020080 lui r2,0x0080
+
  001816d8: 27a60020 addiu r6,r29,0x0020
  0018197c: 8fa800d0 lw r8,0x00d0(r29) load known abilities?
+
  001816dc: 080605c1 j 0x 00181704
  00181980: 02621007 srav r2,r2,r19
+
  001816e0: 00000000 nop
  00181984: 01021024 and r2,r8,r2 known abilities and 0x800000
+
  001816e4: 02002021 addu r4,r16,r0
  00181988: 10400064 beq r2,r0,0x 00181b1c
+
  001816e8: 30a500ff andi r5,r5,0x00ff
  0018198c: 00000000 nop
+
  001816ec: 0c0609e2 jal 0x 00182788
  00181990: 93a400b8 lbu r4,0x00b8(r29) load skillset
+
  001816f0: 27a60078 addiu r6,r29,0x0078
  00181994: 0c01695a jal 0x0005a568 load ability from skillset
+
  001816f4: 080605c1 j 0x 00181704
00181998: 02602821 addu r5,r19,r0
+
  001816f8: 00000000 nop
  0018199c: 8fa90100 lw r9,0x0100(r29)
+
 
  001819a0: 00402021 addu r4,r2,r0
+
  Defend, Equip change, blank, monster, attack, jump
  001819a4: 11200006 beq r9,r0,0x 001819c0 branch if ?? status present?
+
  001816fc: 30c200ff andi r2,r6,0x00ff
  001819a8: a7a400d8 sh r4,0x00d8(r29) store ability
+
  00181700: 2c42000f sltiu r2,r2,0x000f
  001819ac: 00041400 sll r2,r4,0x10
+
 
  001819b0: 00021403 sra r2,r2,0x10
+
  00181704: 8fbf016c lw r31,0x016c(r29)
  001819b4: 3403001d ori r3,r0,0x001d
+
  00181708: 8fb20168 lw r18,0x0168(r29)
  001819b8: 14430058 bne r2,r3,0x 00181b1c branch if ability is not 0x1d frog?
+
  0018170c: 8fb10164 lw r17,0x0164(r29)
  001819bc: 00000000 nop
+
  00181710: 8fb00160 lw r16,0x0160(r29)
  001819c0: 00041400 sll r2,r4,0x10
+
00181714: 27bd0170 addiu r29,r29,0x0170
001819c4: 00021c03 sra r3,r2,0x10
+
00181718: 03e00008 jr r31
  001819c8: 10600054 beq r3,r0,0x 00181b1c branch if ability = 0
+
  0018171c: 00000000 nop
  001819cc: 2482ffff addiu r2,r4,0xffff
+
 
  001819d0: 3042ffff andi r2,r2,0xffff
+
Ability loading?
  001819d4: 2c42016f sltiu r2,r2,0x016f
+
  00181720: 3c038019 lui r3,0x8019
  001819d8: 10400036 beq r2,r0,0x 00181ab4 branch if ability is not a regular ability
+
00181724: 8c63f51c lw r3,-0x0ae4(r3)
  001819dc: 000310c0 sll r2,r3,0x03
+
  00181728: 34020009 ori r2,r0,0x0009
  001819e0: 00431023 subu r2,r2,r3
+
  0018172c: 14620004 bne r3,r2,0x 00181740 branch if not 0x09
  001819e4: 00021040 sll r2,r2,0x01
+
  00181730: 00004021 addu r8,r0,r0
  001819e8: 3c038006 lui r3,0x8006
+
  00181734: 10a00002 beq r5,r0,0x 00181740 branch if 0 CT
  001819ec: 2463fbf0 addiu r3,r3,0xfbf0 load ability data pointer 2
+
  00181738: 00000000 nop
  001819f0: 00432021 addu r4,r2,r3
+
  0018173c: 24a50001 addiu r5,r5,0x0001 CT + 1
  001819f4: 90830006 lbu r3,0x0006(r4)
+
  00181740: 00052a00 sll r5,r5,0x08 (CT + 1)* 128
  001819f8: 00000000 nop
+
  00181744: 340a001f ori r10,r0,0x001f
  001819fc: 30620008 andi r2,r3,0x0008
+
  00181748: 90c30000 lbu r3,0x0000(r6) unit ID?
00181a00: 10400005 beq r2,r0,0x 00181a18 ability requires sword check
+
  0018174c: 00000000 nop
  00181a04: 00000000 nop
+
  00181750: 30690040 andi r9,r3,0x0040 r9 = short charge check?
  00181a08: 8fa800e8 lw r8,0x00e8(r29)
+
00181754: 3063001f andi r3,r3,0x001f
  00181a0c: 00000000 nop
+
  00181758: 106a0017 beq r3,r10,0x 001817b8
  00181a10: 11000042 beq r8,r0,0x 00181b1c
+
  0018175c: 340200ff ori r2,r0,0x00ff
  00181a14: 00000000 nop
+
  00181760: 94c70002 lhu r7,0x0002(r6)
  00181a18: 30620004 andi r2,r3,0x0004
+
  00181764: 00000000 nop
  00181a1c: 10400005 beq r2,r0,0x 00181a34 ability requires materia blade check
+
  00181768: 00e5102a slt r2,r7,r5 set if ?? < (CT + 1)* 128
  00181a20: 00000000 nop
+
  0018176c: 1440000d bne r2,r0,0x 001817a4
  00181a24: 8fa900e0 lw r9,0x00e0(r29)
+
  00181770: 00000000 nop
  00181a28: 00000000 nop
+
  00181774: 14a70009 bne r5,r7,0x 0018179c
00181a2c: 1120003b beq r9,r0,0x 00181b1c
+
  00181778: 00000000 nop
00181a30: 00000000 nop
+
  0018177c: 14830003 bne r4,r3,0x 0018178c
00181a34: 8fa800f8 lw r8,0x00f8(r29) load (half of mp check?)
+
  00181780: 0064102a slt r2,r3,r4
00181a38: 9091000d lbu r17,0x000d(r4) load MP cost
+
  00181784: 15200005 bne r9,r0,0x 0018179c
00181a3c: 11000002 beq r8,r0,0x 00181a48
+
  00181788: 00000000 nop
00181a40: 26220001 addiu r2,r17,0x0001
+
  0018178c: 10400003 beq r2,r0,0x 0018179c
00181a44: 00028843 sra r17,r2,0x01 MP / 2
+
  00181790: 00000000 nop
00181a48: 9082000c lbu r2,0x000c(r4) load CT
+
  00181794: 15200003 bne r9,r0,0x 001817a4
00181a4c: 90830005 lbu r3,0x0005(r4) load flags 3
+
  00181798: 00000000 nop
00181a50: 3050007f andi r16,r2,0x007f r16 = CT
+
  0018179c: 080605ee j 0x 001817b8
00181a54: 000321c2 srl r4,r3,0x07
+
  001817a0: 310200ff andi r2,r8,0x00ff return counter
00181a58: 30620020 andi r2,r3,0x0020 affected by silence
+
  001817a4: 25080001 addiu r8,r8,0x0001 counter++
00181a5c: 00021102 srl r2,r2,0x04
+
  001817a8: 29020028 slti r2,r8,0x0028 limit = 0x28
00181a60: 30630004 andi r3,r3,0x0004 persevere
+
  001817ac: 1440ffe6 bne r2,r0,0x 00181748
00181a64: 1460000b bne r3,r0,0x 00181a94 branch if persevere true
+
  001817b0: 24c60004 addiu r6,r6,0x0004 stack++
00181a68: 00829025 or r18,r4,r2 r18 = silence and persevere checks
+
  001817b4: 340200ff ori r2,r0,0x00ff
00181a6c: 8fa900f0 lw r9,0x00f0(r29)
+
  001817b8: 03e00008 jr r31
00181a70: 34020001 ori r2,r0,0x0001
+
  001817bc: 00000000 nop
00181a74: 15220002 bne r9,r2,0x 00181a80 short charge check?
 
00181a78: 26020001 addiu r2,r16,0x0001
 
00181a7c: 00028043 sra r16,r2,0x01 CT + 1 / 2
 
00181a80: 8fa800f0 lw r8,0x00f0(r29)
 
00181a84: 34020002 ori r2,r0,0x0002
 
00181a88: 15020003 bne r8,r2,0x 00181a98 non-charge check
 
00181a8c: 02002821 addu r5,r16,r0 store (CT + 1)/2
 
00181a90: 00008021 addu r16,r0,r0
 
00181a94: 02002821 addu r5,r16,r0 store 0 CT?
 
00181a98: 8fa400b0 lw r4,0x00b0(r29) load Unit ID
 
00181a9c: 0c0605c8 jal 0x 00181720 ability loading?
 
00181aa0: 27a60010 addiu r6,r29,0x0010
 
00181aa4: a2910000 sb r17,0x0000(r20) store MP cost
 
00181aa8: a2b00000 sb r16,0x0000(r21) store CT
 
00181aac: 080606bc j 0x 00181af0
 
00181ab0: a2d20000 sb r18,0x0000(r22) store silence/persevere checks?
 
00181ab4: 2482fe6a addiu r2,r4,0xfe6a
 
00181ab8: 3042ffff andi r2,r2,0xffff
 
00181abc: 2c420008 sltiu r2,r2,0x0008
 
00181ac0: 1040000c beq r2,r0,0x 00181af4 branch if not charge ability
 
00181ac4: 00031040 sll r2,r3,0x01
 
00181ac8: 27a60010 addiu r6,r29,0x0010
 
00181acc: 3c018006 lui r1,0x8006
 
00181ad0: 00220821 addu r1,r1,r2
 
00181ad4: 90300d18 lbu r16,0x0d18(r1) load CT?
 
00181ad8: 8fa400b0 lw r4,0x00b0(r29)
 
00181adc: 0c0605c8 jal 0x 00181720
 
00181ae0: 02002821 addu r5,r16,r0
 
00181ae4: a2800000 sb r0,0x0000(r20) store 0 for mp cost
 
00181ae8: a2b00000 sb r16,0x0000(r21) store CT
 
00181aec: a2c00000 sb r0,0x0000(r22) store 0 for silence/persevere checks
 
00181af0: a2e20000 sb r2,0x0000(r23) store unit ID?
 
00181af4: 26f70001 addiu r23,r23,0x0001
 
00181af8: 26d60001 addiu r22,r22,0x0001
 
00181afc: 26b50001 addiu r21,r21,0x0001
 
00181b00: 26940001 addiu r20,r20,0x0001
 
00181b04: 97a800d8 lhu r8,0x00d8(r29) load ability ID
 
00181b08: 8fa900c0 lw r9,0x00c0(r29) load pointer address
 
00181b0c: 27de0001 addiu r30,r30,0x0001
 
00181b10: a5280000 sh r8,0x0000(r9) store ability ID
 
00181b14: 25290002 addiu r9,r9,0x0002
 
00181b18: afa900c0 sw r9,0x00c0(r29) store new stack pointer?
 
00181b1c: 26730001 addiu r19,r19,0x0001
 
00181b20: 2a620010 slti r2,r19,0x0010 run 15 times - for each ability?
 
00181b24: 1440ff95 bne r2,r0,0x 0018197c
 
00181b28: 3c020080 lui r2,0x0080
 
00181b2c: 8fa900c0 lw r9,0x00c0(r29)
 
00181b30: 2402ffff addiu r2,r0,0xffff
 
00181b34: a5220000 sh r2,0x0000(r9) store ??
 
00181b38: 03c01021 addu r2,r30,r0 return number of abilities?
 
00181b3c: 8fbf012c lw r31,0x012c(r29)
 
00181b40: 8fbe0128 lw r30,0x0128(r29)
 
00181b44: 8fb70124 lw r23,0x0124(r29)
 
00181b48: 8fb60120 lw r22,0x0120(r29)
 
00181b4c: 8fb5011c lw r21,0x011c(r29)
 
00181b50: 8fb40118 lw r20,0x0118(r29)
 
00181b54: 8fb30114 lw r19,0x0114(r29)
 
00181b58: 8fb20110 lw r18,0x0110(r29)
 
00181b5c: 8fb1010c lw r17,0x010c(r29)
 
00181b60: 8fb00108 lw r16,0x0108(r29)
 
00181b64: 27bd0130 addiu r29,r29,0x0130
 
  00181b68: 03e00008 jr r31
 
  00181b6c: 00000000 nop
 

Revision as of 16:49, 24 February 2013

Skillset Loading?
r6 = action menu byte
00181584: 27bdfe90 addiu r29,r29,0xfe90
00181588: afb00160 sw r16,0x0160(r29)
0018158c: 00808021 addu r16,r4,r0				unit ID
00181590: 001010c0 sll r2,r16,0x03
00181594: 00501023 subu r2,r2,r16
00181598: 00021180 sll r2,r2,0x06
0018159c: afbf016c sw r31,0x016c(r29)
001815a0: afb20168 sw r18,0x0168(r29)
001815a4: afb10164 sw r17,0x0164(r29)
001815a8: 3c018019 lui r1,0x8019
001815ac: 00220821 addu r1,r1,r2
001815b0: 90220926 lbu r2,0x0926(r1)			load current status 3
001815b4: 00000000 nop
001815b8: 30420002 andi r2,r2,0x0002
001815bc: 10400009 beq r2,r0,0x 001815e4			branch if not frog
001815c0: 30c300ff andi r3,r6,0x00ff			r3 = action menu byte
001815c4: 10600007 beq r3,r0,0x 001815e4			branch if default
001815c8: 34020006 ori r2,r0,0x0006
001815cc: 10620005 beq r3,r2,0x 001815e4			branch if monster
001815d0: 34020008 ori r2,r0,0x0008
001815d4: 10620003 beq r3,r2,0x 001815e4			branch if attack
001815d8: 34020005 ori r2,r0,0x0005
001815dc: 14620049 bne r3,r2,0x 00181704			branch if not blank
001815e0: 00001021 addu r2,r0,r0
001815e4: 2c62000b sltiu r2,r3,0x000b			set if action menu is < defend, equip change		
001815e8: 10400044 beq r2,r0,0x 001816fc
001815ec: 00031080 sll r2,r3,0x02
001815f0: 3c018017 lui r1,0x8017
001815f4: 00220821 addu r1,r1,r2
001815f8: 8c224144 lw r2,0x4144(r1)				
001815fc: 00000000 nop
00181600: 00400008 jr r2
00181604: 00000000 nop

					00174144: 80181608 lb r24,0x1608(r0)	default
					00174148: 80181640 lb r24,0x1640(r0)	item
					0017414c: 80181658 lb r24,0x1658(r0)	weapon inv.
					00174150: 80181670 lb r24,0x1670(r0)	math skill
					00174154: 801816b8 lb r24,0x16b8(r0)	Elemental
					00174158: 801816fc lb r24,0x16fc(r0)	blank
					0017415c: 801816fc lb r24,0x16fc(r0)	monster
					00174160: 801816cc lb r24,0x16cc(r0)	katana inv.
					00174164: 801816fc lb r24,0x16fc(r0)	attack
					00174168: 801816fc lb r24,0x16fc(r0)	jump
					0017416c: 801816e4 lb r24,0x16e4(r0)	charge
					defend and equip change hardcoded in routine
Default
00181608: 02002021 addu r4,r16,r0				unit ID
0018160c: 30a500ff andi r5,r5,0x00ff			r5 = skillset
00181610: 27a60078 addiu r6,r29,0x0078
00181614: 27a20118 addiu r2,r29,0x0118
00181618: afa20010 sw r2,0x0010(r29)
0018161c: 27a20130 addiu r2,r29,0x0130
00181620: afa2 0018 sw r2,0x 0018(r29)
00181624: 27a20148 addiu r2,r29,0x0148
00181628: 27a70100 addiu r7,r29,0x0100
0018162c: afa00014 sw r0,0x0014(r29)
00181630: 0c0605f0 jal 0x 001817c0				Skillset Loading
00181634: afa2001c sw r2,0x001c(r29)
00181638: 080605c1 j 0x 00181704
0018163c: 00000000 nop
Item
00181640: 02002021 addu r4,r16,r0
00181644: 30a500ff andi r5,r5,0x00ff
00181648: 0c0606e5 jal 0x 00181b94
0018164c: 27a60020 addiu r6,r29,0x0020
00181650: 080605c1 j 0x 00181704
00181654: 00000000 nop
Weapon Inventory
00181658: 02002021 addu r4,r16,r0
0018165c: 30a500ff andi r5,r5,0x00ff
00181660: 0c060737 jal 0x 00181cdc				find number of throwable items
00181664: 27a60020 addiu r6,r29,0x0020
00181668: 080605c1 j 0x 00181704					jump to end
0018166c: 00000000 nop							r2 = number of throwable items + 0x100
Math Skill
00181670: 02002021 addu r4,r16,r0
00181674: 30b200ff andi r18,r5,0x00ff
00181678: 02402821 addu r5,r18,r0
0018167c: 27b10078 addiu r17,r29,0x0078
00181680: 0c0607bc jal 0x 00181ef0
00181684: 02203021 addu r6,r17,r0
00181688: 1040001e beq r2,r0,0x 00181704
0018168c: 02002021 addu r4,r16,r0
00181690: 02402821 addu r5,r18,r0
00181694: 0c0607c5 jal 0x 00181f14
00181698: 02203021 addu r6,r17,r0
0018169c: 10400019 beq r2,r0,0x 00181704
001816a0: 02002021 addu r4,r16,r0
001816a4: 02402821 addu r5,r18,r0
001816a8: 0c06081a jal 0x 00182068
001816ac: 02203021 addu r6,r17,r0
001816b0: 080605c1 j 0x 00181704
001816b4: 00000000 nop
Elemental
001816b8: 02002021 addu r4,r16,r0
001816bc: 0c060873 jal 0x 001821cc
001816c0: 30a500ff andi r5,r5,0x00ff
001816c4: 080605c1 j 0x 00181704
001816c8: 3042ffff andi r2,r2,0xffff
001816cc: 02002021 addu r4,r16,r0
001816d0: 30a500ff andi r5,r5,0x00ff
001816d4: 0c0609a2 jal 0x 00182688
001816d8: 27a60020 addiu r6,r29,0x0020
001816dc: 080605c1 j 0x 00181704
001816e0: 00000000 nop
001816e4: 02002021 addu r4,r16,r0
001816e8: 30a500ff andi r5,r5,0x00ff
001816ec: 0c0609e2 jal 0x 00182788
001816f0: 27a60078 addiu r6,r29,0x0078
001816f4: 080605c1 j 0x 00181704
001816f8: 00000000 nop
Defend, Equip change, blank, monster, attack, jump
001816fc: 30c200ff andi r2,r6,0x00ff
00181700: 2c42000f sltiu r2,r2,0x000f
00181704: 8fbf016c lw r31,0x016c(r29)
00181708: 8fb20168 lw r18,0x0168(r29)
0018170c: 8fb10164 lw r17,0x0164(r29)
00181710: 8fb00160 lw r16,0x0160(r29)
00181714: 27bd0170 addiu r29,r29,0x0170
00181718: 03e00008 jr r31
0018171c: 00000000 nop
Ability loading?
00181720: 3c038019 lui r3,0x8019
00181724: 8c63f51c lw r3,-0x0ae4(r3)			
00181728: 34020009 ori r2,r0,0x0009
0018172c: 14620004 bne r3,r2,0x 00181740			branch if not 0x09
00181730: 00004021 addu r8,r0,r0
00181734: 10a00002 beq r5,r0,0x 00181740			branch if 0 CT
00181738: 00000000 nop
0018173c: 24a50001 addiu r5,r5,0x0001			CT + 1
00181740: 00052a00 sll r5,r5,0x08				(CT + 1)* 128
00181744: 340a001f ori r10,r0,0x001f
00181748: 90c30000 lbu r3,0x0000(r6)			unit ID?
0018174c: 00000000 nop
00181750: 30690040 andi r9,r3,0x0040			r9 = short charge check?
00181754: 3063001f andi r3,r3,0x001f			
00181758: 106a0017 beq r3,r10,0x 001817b8
0018175c: 340200ff ori r2,r0,0x00ff
00181760: 94c70002 lhu r7,0x0002(r6)
00181764: 00000000 nop
00181768: 00e5102a slt r2,r7,r5					set if ?? < (CT + 1)* 128
0018176c: 1440000d bne r2,r0,0x 001817a4
00181770: 00000000 nop
00181774: 14a70009 bne r5,r7,0x 0018179c
00181778: 00000000 nop
0018177c: 14830003 bne r4,r3,0x 0018178c
00181780: 0064102a slt r2,r3,r4
00181784: 15200005 bne r9,r0,0x 0018179c
00181788: 00000000 nop
0018178c: 10400003 beq r2,r0,0x 0018179c
00181790: 00000000 nop
00181794: 15200003 bne r9,r0,0x 001817a4
00181798: 00000000 nop
0018179c: 080605ee j 0x 001817b8
001817a0: 310200ff andi r2,r8,0x00ff			return counter
001817a4: 25080001 addiu r8,r8,0x0001			counter++
001817a8: 29020028 slti r2,r8,0x0028			limit = 0x28
001817ac: 1440ffe6 bne r2,r0,0x 00181748			
001817b0: 24c60004 addiu r6,r6,0x0004			stack++
001817b4: 340200ff ori r2,r0,0x00ff
001817b8: 03e00008 jr r31
001817bc: 00000000 nop