Difference between revisions of "Calculate AT List"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
m
m
 
(One intermediate revision by the same user not shown)
Line 3: Line 3:
 
  0018370c: 3c028019 lui r2,0x8019
 
  0018370c: 3c028019 lui r2,0x8019
 
  00183710: 8c42f51c lw r2,-0x0ae4(r2) Load ?
 
  00183710: 8c42f51c lw r2,-0x0ae4(r2) Load ?
  00183714: 27bdff58 addiu r29,r29,0xff58 -0xA8
+
  00183714: 27bdff58 addiu r29,r29,0xff58 Stack Pointer -= 0xA8
 
  00183718: afbe00a0 sw r30,0x00a0(r29)
 
  00183718: afbe00a0 sw r30,0x00a0(r29)
 
  0018371c: 0000f021 addu r30,r0,r0 Act Counter = 0
 
  0018371c: 0000f021 addu r30,r0,r0 Act Counter = 0

Latest revision as of 16:46, 9 July 2023

0018370c: 3c028019 lui r2,0x8019
00183710: 8c42f51c lw r2,-0x0ae4(r2)		Load ?
00183714: 27bdff58 addiu r29,r29,0xff58		Stack Pointer -= 0xA8
00183718: afbe00a0 sw r30,0x00a0(r29)
0018371c: 0000f021 addu r30,r0,r0		Act Counter = 0
00183720: afb60098 sw r22,0x0098(r29)
00183724: 0000b021 addu r22,r0,r0		Counter = 0
00183728: afa40060 sw r4,0x0060(r29)		Store Stack Pointer + 0xB8
0018372c: 8fa30060 lw r3,0x0060(r29)		Load Stack Pointer
00183730: 340400ff ori r4,r0,0x00ff		r4 = FF
00183734: afa50068 sw r5,0x0068(r29)		Store Preset Value
00183738: 3405ffff ori r5,r0,0xffff		r5 = FFFF
0018373c: afbf00a4 sw r31,0x00a4(r29)
00183740: afb7009c sw r23,0x009c(r29)
00183744: afb50094 sw r21,0x0094(r29)
00183748: afb40090 sw r20,0x0090(r29)
0018374c: afb3008c sw r19,0x008c(r29)
00183750: afb20088 sw r18,0x0088(r29)
00183754: afb10084 sw r17,0x0084(r29)
00183758: afb00080 sw r16,0x0080(r29)
0018375c: 38420009 xori r2,r2,0x0009		flip bitflags 1 and 8
00183760: 2c420001 sltiu r2,r2,0x0001		r2 = 0x1 if ? = 0x8, r2 = 0x8 if ? = 0x1, r2 = 0x9 if ? = 0, r2 = 0x0 if ? = 0x9. other bitflags are kept the same.
00183764: afa20070 sw r2,0x0070(r29)		(store result for later)
00183768: a0640000 sb r4,0x0000(r3)			Store Unit ID = FF
0018376c: a0640001 sb r4,0x0001(r3)			Store Last Attack ID = FF
00183770: a4650002 sh r5,0x0002(r3)			Store CTs to stack (for first argument in AT list?)
00183774: 26d60001 addiu r22,r22,0x0001		Counter += 1
00183778: 2ac20028 slti r2,r22,0x0028
0018377c: 1440fffa bne r2,r0,0x00183768		Branch if Counter < 0x28
00183780: 24630004 addiu r3,r3,0x0004		Stack Pointer + 4
00183784: 8fa90068 lw r9,0x0068(r29)		Load Preset Value (when called from Load ability data for skillset, is always 0)
00183788: 34020002 ori r2,r0,0x0002		r2 = 2 (PV is never 2 from what i've seen)
0018378c: 1122000a beq r9,r2,0x001837b8		Branch if PV = 2 (skip AT List initializing)
00183790: 0000b021 addu r22,r0,r0		Counter = 0
00183794: 0c060445 jal 0x00181114		Find Active Unit Data Pointer?
00183798: 00000000 nop
0018379c: 00408821 addu r17,r2,r0		r17 = Active Unit Data Pointer
001837a0: 12200005 beq r17,r0,0x001837b8	Branch if no unit is active
001837a4: 00002821 addu r5,r0,r0		r5 = 0 (skip skillset check)
001837a8: 9224018a lbu r4,0x018a(r17)		Load Unit's Misc (?) Unit ID
001837ac: 8fa70060 lw r7,0x0060(r29)		Load Stack Pointer
001837b0: 0c060eb3 jal 0x00183acc		AT List Sorting
001837b4: 00003021 addu r6,r0,r0		r6 = 0
001837b8: afa00078 sw r0,0x0078(r29)		Store Unit Pointer Mod = 0
001837bc: 8fa90078 lw r9,0x0078(r29)		Load Unit Pointer Mod
001837c0: 3c028019 lui r2,0x8019
001837c4: 244208cc addiu r2,r2,0x08cc
001837c8: 01228821 addu r17,r9,r2		r17 = Unit Data Pointer
001837cc: 0c060d6a jal 0x001835a8		Check if Unit Exists and isn't Dead/Crystal/Petrified/Treasure/Ridden
001837d0: 02202021 addu r4,r17,r0		r4 = Unit Data Pointer
001837d4: 144000a8 bne r2,r0,0x00183a78		Branch if Unit can't act
001837d8: 00000000 nop
001837dc: 9222005b lbu r2,0x005b(r17)		Load Unit's Current Statuses 4
001837e0: 00000000 nop
001837e4: 30420002 andi r2,r2,0x0002
001837e8: 10400002 beq r2,r0,0x001837f4		Branch if Unit isn't Stopped
001837ec: 0000a821 addu r21,r0,r0		Stop/Sleep CT = 0
001837f0: 92350063 lbu r21,0x0063(r17)		Stop/Sleep CT = Stop CT
001837f4: 9222005c lbu r2,0x005c(r17)		Load Unit's Current Statuses 5
001837f8: 00000000 nop
001837fc: 30420010 andi r2,r2,0x0010
00183800: 10400007 beq r2,r0,0x00183820		Branch if Unit isn't Sleeping
00183804: 00000000 nop
00183808: 92230068 lbu r3,0x0068(r17)		Load Unit's Sleep CT
0018380c: 00000000 nop
00183810: 02a3102b sltu r2,r21,r3
00183814: 10400002 beq r2,r0,0x00183820		Branch if Stop/Sleep CT >= Sleep CT
00183818: 00000000 nop
0018381c: 0060a821 addu r21,r3,r0		Stop/Sleep CT = Sleep CT
00183820: 9223015d lbu r3,0x015d(r17)		Load Unit's Current Ability CT
00183824: 340200ff ori r2,r0,0x00ff		r2 = FF
00183828: 306400ff andi r4,r3,0x00ff		r4 = Current Ability CT
0018382c: 1082002f beq r4,r2,0x001838ec		Branch if Unit isn't charging something
00183830: 34020001 ori r2,r0,0x0001		r2 = 1
If charging something
00183834: 8fa90068 lw r9,0x0068(r29)		Load Preset Value
00183838: 00000000 nop
0018383c: 1122002c beq r9,r2,0x001838f0		Branch if PV = 1 (skip to next)
00183840: 00000000 nop
00183844: 14800007 bne r4,r0,0x00183864		Branch if Current Ability CT != 0
00183848: 02a39021 addu r18,r21,r3		CT = Stop/Sleep CT + Current Ability CT
0018384c: 92220186 lbu r2,0x0186(r17)		Load Unit's Turn Flag?
00183850: 00000000 nop
00183854: 10400003 beq r2,r0,0x00183864		Branch if it's not the unit's turn?
00183858: 34020003 ori r2,r0,0x0003		r2 = 3
0018385c: 11220005 beq r9,r2,0x00183874		Branch if PV = 3
00183860: 02c02021 addu r4,r22,r0		r4 = Counter
00183864: 8fa90070 lw r9,0x0070(r29)		Load ?
00183868: 00000000 nop
0018386c: 02499021 addu r18,r18,r9		CT += 1 (if 0x185f1c = 9) or 0
00183870: 02c02021 addu r4,r22,r0		r4 = Counter
00183874: 34050001 ori r5,r0,0x0001		r5 = 1 (perform skillset check)
00183878: 00123200 sll r6,r18,0x08		r6 = CT * 0x100
0018387c: 8fa70060 lw r7,0x0060(r29)		Load Stack Pointer
00183880: 0c060eb3 jal 0x00183acc		AT List Sorting
00183884: 30c6ff00 andi r6,r6,0xff00		r6 = FF00 (charging/performing? CT)
00183888: 92230058 lbu r3,0x0058(r17)		Load Unit's Current Statuses 1
0018388c: 00000000 nop
00183890: 30630001 andi r3,r3,0x0001
00183894: 10600015 beq r3,r0,0x001838ec		Branch if Unit isn't Performing
00183898: 03c2f021 addu r30,r30,r2		Act Counter += 1 if ability made it on the list
0018389c: 0c0179de jal 0x0005e778		Transfer Last Ability Used CT
001838a0: 02202021 addu r4,r17,r0		r4 = Unit's Data Pointer
001838a4: 0000a021 addu r20,r0,r0		Perform Counter = 0
001838a8: 9222018b lbu r2,0x018b(r17)		Load Ability CT
001838ac: 00000000 nop
001838b0: 00529021 addu r18,r2,r18		CT += Ability CT (get next perform CT)
001838b4: 3246ffff andi r6,r18,0xffff		r6 = CT
001838b8: 2cc20100 sltiu r2,r6,0x0100
001838bc: 1040000b beq r2,r0,0x001838ec		Branch if CT >= 0x100
001838c0: 02c02021 addu r4,r22,r0		r4 = Counter
001838c4: 00063200 sll r6,r6,0x08		CT * 0x100
001838c8: 34050001 ori r5,r0,0x0001		r5 = 1 (perform skillset check)
001838cc: 8fa70060 lw r7,0x0060(r29)		Load Stack Pointer
001838d0: 0c060eb3 jal 0x00183acc		AT List Sorting
001838d4: 30c6ff00 andi r6,r6,0xff00		r6 = CT
001838d8: 03c2f021 addu r30,r30,r2		Act Counter += 1 if ability made it on the list
001838dc: 26940001 addiu r20,r20,0x0001		Perform Counter ++
001838e0: 2a820027 slti r2,r20,0x0027
001838e4: 1440fff0 bne r2,r0,0x001838a8		Branch if Perform Counter < 0x27
001838e8: 00000000 nop
001838ec: 8fa90068 lw r9,0x0068(r29)		Load Preset Value
001838f0: 34020002 ori r2,r0,0x0002
001838f4: 11220060 beq r9,r2,0x00183a78		Branch if PV = 2 (again, don't see this set anywhere)
001838f8: 00000000 nop
001838fc: 00009821 addu r19,r0,r0		Slow CT = 0
00183900: 9223005b lbu r3,0x005b(r17)		Load Unit's Current Statuses 4
00183904: 92240051 lbu r4,0x0051(r17)		Load Unit's Innate Statuses 4
00183908: 30620004 andi r2,r3,0x0004
0018390c: 1040000a beq r2,r0,0x00183938		Branch if Unit doesn't have slow
00183910: 00008021 addu r16,r0,r0		Haste CT = 0
00183914: 92330062 lbu r19,0x0062(r17)		Load Unit's Slow CT
00183918: 30820004 andi r2,r4,0x0004
0018391c: 10400003 beq r2,r0,0x0018392c		Branch if Unit doesn't have innate slow
00183920: 02759823 subu r19,r19,r21		Slow CT -= Stop/Sleep CT
00183924: 34130200 ori r19,r0,0x0200		Slow CT = 0x200
00183928: 02759823 subu r19,r19,r21		Slow CT -= Stop/Sleep CT
0018392c: 06610003 bgez r19,0x0018393c		Branch if Slow CT >= 0
00183930: 30620008 andi r2,r3,0x0008		
00183934: 00009821 addu r19,r0,r0		Slow CT = 0
00183938: 30620008 andi r2,r3,0x0008
0018393c: 10400009 beq r2,r0,0x00183964		Branch if Unit doesn't have Haste
00183940: 30820008 andi r2,r4,0x0008
00183944: 92300061 lbu r16,0x0061(r17)		Load Unit's Haste CT
00183948: 10400003 beq r2,r0,0x00183958		Branch if Unit doesn't have innate Haste
0018394c: 02158023 subu r16,r16,r21		Haste CT -= Stop/Sleep CT
00183950: 34100200 ori r16,r0,0x0200		Haste CT = 0x200
00183954: 02158023 subu r16,r16,r21		Haste CT -= Stop/Sleep CT
00183958: 06010002 bgez r16,0x00183964		Branch if Haste CT >= 0
0018395c: 00000000 nop
00183960: 00008021 addu r16,r0,r0		Haste CT = 0
00183964: 92370038 lbu r23,0x0038(r17)		Load Unit's SP
00183968: 00000000 nop
0018396c: 16e00002 bne r23,r0,0x00183978	Branch if SP != 0
00183970: 02a09021 addu r18,r21,r0		r18 = Sleep/Stop CT
00183974: 34170001 ori r23,r0,0x0001		SP = 1
00183978: 92310039 lbu r17,0x0039(r17)		Load Unit's CT
0018397c: 08060e7a j 0x001839e8
00183980: 0000a021 addu r20,r0,r0		AT Counter = 0
00183984: 1260000a beq r19,r0,0x001839b0	Branch if Slow CT = 0
00183988: 02e01821 addu r3,r23,r0		r3 = SP
0018398c: 306200ff andi r2,r3,0x00ff		r2 = SP
00183990: 00021842 srl r3,r2,0x01		SP / 2
00183994: 14600002 bne r3,r0,0x001839a0		Branch if SP / 2 != 0
00183998: 2673ffff addiu r19,r19,0xffff		Slow CT --
0018399c: 34030001 ori r3,r0,0x0001		SP = 1
001839a0: 1200000b beq r16,r0,0x001839d0	Branch if Haste CT = 0
001839a4: 306200ff andi r2,r3,0x00ff		r2 = SP
001839a8: 08060e74 j 0x001839d0
001839ac: 2610ffff addiu r16,r16,0xffff		Haste CT --
001839b0: 12000007 beq r16,r0,0x001839d0	Branch if Haste CT = 0
001839b4: 306200ff andi r2,r3,0x00ff		r2 = SP
001839b8: 2610ffff addiu r16,r16,0xffff		Haste CT --
001839bc: 306300ff andi r3,r3,0x00ff
001839c0: 00031040 sll r2,r3,0x01		SP * 2
001839c4: 00431021 addu r2,r2,r3		SP + SP * 2
001839c8: 00021842 srl r3,r2,0x01		SP * 1.5
001839cc: 306200ff andi r2,r3,0x00ff
001839d0: 02221021 addu r2,r17,r2		(useless step)
001839d4: 00408821 addu r17,r2,r0		CT += SP
001839d8: 3242ffff andi r2,r18,0xffff		r2 = Sleep/Stop CT
001839dc: 2c4201f5 sltiu r2,r2,0x01f5
001839e0: 10400007 beq r2,r0,0x00183a00		Branch if Sleep/Stop CT >= 501
001839e4: 3246ffff andi r6,r18,0xffff		r6 = Sleep/Stop CT
001839e8: 3222ffff andi r2,r17,0xffff		r2 = CT
001839ec: 2c420064 sltiu r2,r2,0x0064
001839f0: 1440ffe4 bne r2,r0,0x00183984		Branch if CT < 100
001839f4: 26520001 addiu r18,r18,0x0001		Sleep/Stop CT += 1
001839f8: 2652ffff addiu r18,r18,0xffff		Sleep/Stop CT -= 1
001839fc: 3246ffff andi r6,r18,0xffff		r6 = Sleep/Stop CT
00183a00: 2cc20100 sltiu r2,r6,0x0100
00183a04: 1040001c beq r2,r0,0x00183a78		Branch if Sleep/Stop CT >= 256
00183a08: 3c0251eb lui r2,0x51eb
00183a0c: 3442851f ori r2,r2,0x851f
00183a10: 3228ffff andi r8,r17,0xffff		r8 = CT
00183a14: 01020019 multu r8,r2			CT * 0.32
00183a18: 02c02021 addu r4,r22,r0		r4 = Counter
00183a1c: 00002821 addu r5,r0,r0		r5 = 0 (skip skillset check)
00183a20: 8fa70060 lw r7,0x0060(r29)		Load Stack Pointer
00183a24: 00063200 sll r6,r6,0x08		Sleep/Stop CT * 0x100
00183a28: 24c60064 addiu r6,r6,0x0064		Sleep/Stop CT * 0x100 + 100
00183a2c: 00001810 mfhi r3			r3 = CT * 0.32
00183a30: 00031942 srl r3,r3,0x05		CT / 100
00183a34: 00031040 sll r2,r3,0x01		CT / 100 * 2
00183a38: 00431021 addu r2,r2,r3		CT / 100 * 3
00183a3c: 000210c0 sll r2,r2,0x03		CT / 100 * 24
00183a40: 00431021 addu r2,r2,r3		CT / 100 * 25
00183a44: 00021080 sll r2,r2,0x02		CT / 100 * 100
00183a48: 01024023 subu r8,r8,r2		CT -= CT / 100 * 100
00183a4c: 01008821 addu r17,r8,r0		r17 = Remaining CT
00183a50: 00c83023 subu r6,r6,r8		Sleep/Stop CT -= CT (note that 100 was added to S/S CT above)
00183a54: 0c060eb3 jal 0x00183acc		AT List Sorting
00183a58: 30c6ffff andi r6,r6,0xffff
00183a5c: 10400006 beq r2,r0,0x00183a78		Branch if AT list is full
00183a60: 00000000 nop
00183a64: 03c2f021 addu r30,r30,r2		Act Counter += 1 if unit made it on the list
00183a68: 26940001 addiu r20,r20,0x0001		AT Counter ++
00183a6c: 2a820028 slti r2,r20,0x0028
00183a70: 1440ffde bne r2,r0,0x001839ec		Branch if AT Counter < 40
00183a74: 3222ffff andi r2,r17,0xffff		r2 = Remaining CT
00183a78: 26d60001 addiu r22,r22,0x0001		Counter ++
00183a7c: 8fa90078 lw r9,0x0078(r29)		Load Unit Pointer Mod
00183a80: 2ac20015 slti r2,r22,0x0015
00183a84: 252901c0 addiu r9,r9,0x01c0		Pointer Mod += 0x1c0
00183a88: 1440ff4c bne r2,r0,0x001837bc		Branch if Counter < 0x15
00183a8c: afa90078 sw r9,0x0078(r29)		Store new Pointer Mod
00183a90: 2fc20001 sltiu r2,r30,0x0001
00183a94: 00021023 subu r2,r0,r2		= -1 if no units/abilities were added to the list?
00183a98: 8fbf00a4 lw r31,0x00a4(r29)
00183a9c: 8fbe00a0 lw r30,0x00a0(r29)
00183aa0: 8fb7009c lw r23,0x009c(r29)
00183aa4: 8fb60098 lw r22,0x0098(r29)
00183aa8: 8fb50094 lw r21,0x0094(r29)
00183aac: 8fb40090 lw r20,0x0090(r29)
00183ab0: 8fb3008c lw r19,0x008c(r29)
00183ab4: 8fb20088 lw r18,0x0088(r29)
00183ab8: 8fb10084 lw r17,0x0084(r29)
00183abc: 8fb00080 lw r16,0x0080(r29)
00183ac0: 27bd00a8 addiu r29,r29,0x00a8
00183ac4: 03e00008 jr r31
00183ac8: 00000000 nop