Difference between revisions of "Get Number of Turns to Resolve(Alt)"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
Line 3: Line 3:
 
  00181724: 8c63f51c lw r3,-0x0ae4(r3) load ?? ability slot counter?
 
  00181724: 8c63f51c lw r3,-0x0ae4(r3) load ?? ability slot counter?
 
  00181728: 34020009 ori r2,r0,0x0009
 
  00181728: 34020009 ori r2,r0,0x0009
  0018172c: 14620004 bne r3,r2,0x 00181740 branch if not 0x09 - active turn
+
  0018172c: 14620004 bne r3,r2,0x00181740 branch if not 0x09 - active turn
 
  00181730: 00004021 addu r8,r0,r0
 
  00181730: 00004021 addu r8,r0,r0
  00181734: 10a00002 beq r5,r0,0x 00181740 branch if 0 CT
+
  00181734: 10a00002 beq r5,r0,0x00181740 branch if 0 CT
 
  00181738: 00000000 nop
 
  00181738: 00000000 nop
 
  0018173c: 24a50001 addiu r5,r5,0x0001 CT + 1
 
  0018173c: 24a50001 addiu r5,r5,0x0001 CT + 1
 
  00181740: 00052a00 sll r5,r5,0x08 (CT + 1)* 128
 
  00181740: 00052a00 sll r5,r5,0x08 (CT + 1)* 128
 
  00181744: 340a001f ori r10,r0,0x001f
 
  00181744: 340a001f ori r10,r0,0x001f
  00181748: 90c30000 lbu r3,0x0000(r6) stack + 0x10
+
  00181748: 90c30000 lbu r3,0x0000(r6) AT list Unit ID
 
  0018174c: 00000000 nop
 
  0018174c: 00000000 nop
 
  00181750: 30690040 andi r9,r3,0x0040 r9 = mounted check?
 
  00181750: 30690040 andi r9,r3,0x0040 r9 = mounted check?
 
  00181754: 3063001f andi r3,r3,0x001f
 
  00181754: 3063001f andi r3,r3,0x001f
  00181758: 106a0017 beq r3,r10,0x 001817b8              branch if id = 1f?
+
  00181758: 106a0017 beq r3,r10,0x 001817b8              branch if Unit ID is 0x1f?
  0018175c: 340200ff ori r2,r0,0x00ff
+
  0018175c: 340200ff ori r2,r0,0x00ff number of turns until resolution: 255
 
  00181760: 94c70002 lhu r7,0x0002(r6)                  load units CT
 
  00181760: 94c70002 lhu r7,0x0002(r6)                  load units CT
 
  00181764: 00000000 nop
 
  00181764: 00000000 nop
 
  00181768: 00e5102a slt r2,r7,r5 set if units CT < (CT + 1)* 128
 
  00181768: 00e5102a slt r2,r7,r5 set if units CT < (CT + 1)* 128
  0018176c: 1440000d bne r2,r0,0x 001817a4               branch if next unit after ability
+
  0018176c: 1440000d bne r2,r0,0x001817a4               branch if next unit after ability
 
  00181770: 00000000 nop
 
  00181770: 00000000 nop
  00181774: 14a70009 bne r5,r7,0x 0018179c               branch if not same CT
+
  00181774: 14a70009 bne r5,r7,0x0018179c               branch if not same CT
 
  00181778: 00000000 nop
 
  00181778: 00000000 nop
  0018177c: 14830003 bne r4,r3,0x 0018178c
+
  0018177c: 14830003 bne r4,r3,0x0018178c branch if Unit ID <> Unit ID in AT list
  00181780: 0064102a slt r2,r3,r4
+
  00181780: 0064102a slt r2,r3,r4 r2 = 1 if AT list Unit ID < Unit ID?
  00181784: 15200005 bne r9,r0,0x 0018179c
+
  00181784: 15200005 bne r9,r0,0x0018179c branch if unit is mounted (no valid turns?)
 
  00181788: 00000000 nop
 
  00181788: 00000000 nop
  0018178c: 10400003 beq r2,r0,0x 0018179c
+
  0018178c: 10400003 beq r2,r0,0x0018179c Branch if unit had a turn before...?
 
  00181790: 00000000 nop
 
  00181790: 00000000 nop
  00181794: 15200003 bne r9,r0,0x 001817a4
+
  00181794: 15200003 bne r9,r0,0x001817a4 branch if unit is mounted? (again?)
 
  00181798: 00000000 nop
 
  00181798: 00000000 nop
  0018179c: 080605ee j 0x 001817b8
+
  0018179c: 080605ee j 0x001817b8
 
  001817a0: 310200ff andi r2,r8,0x00ff return number of turns before resolution
 
  001817a0: 310200ff andi r2,r8,0x00ff return number of turns before resolution
  001817a4: 25080001 addiu r8,r8,0x0001 counter++
+
  001817a4: 25080001 addiu r8,r8,0x0001 #entries in AT list
 
  001817a8: 29020028 slti r2,r8,0x0028 limit = 0x28
 
  001817a8: 29020028 slti r2,r8,0x0028 limit = 0x28
  001817ac: 1440ffe6 bne r2,r0,0x 00181748
+
  001817ac: 1440ffe6 bne r2,r0,0x00181748 Check next unit in AT list, 0x28 times (AT list limit is 40 bytes? 10 units?)
  001817b0: 24c60004 addiu r6,r6,0x0004 stack++
+
  001817b0: 24c60004 addiu r6,r6,0x0004 AT list + 4
 
  001817b4: 340200ff ori r2,r0,0x00ff
 
  001817b4: 340200ff ori r2,r0,0x00ff
 
  001817b8: 03e00008 jr r31
 
  001817b8: 03e00008 jr r31
 
  001817bc: 00000000 nop
 
  001817bc: 00000000 nop

Revision as of 04:30, 19 February 2022

Ability loading?
00181720: 3c038019 lui r3,0x8019
00181724: 8c63f51c lw r3,-0x0ae4(r3)			load ?? ability slot counter?
00181728: 34020009 ori r2,r0,0x0009
0018172c: 14620004 bne r3,r2,0x00181740		branch if not 0x09 - active turn
00181730: 00004021 addu r8,r0,r0
00181734: 10a00002 beq r5,r0,0x00181740		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)			AT list Unit ID
0018174c: 00000000 nop
00181750: 30690040 andi r9,r3,0x0040			r9 = mounted check?
00181754: 3063001f andi r3,r3,0x001f			
00181758: 106a0017 beq r3,r10,0x 001817b8              branch if Unit ID is 0x1f?
0018175c: 340200ff ori r2,r0,0x00ff			number of turns until resolution: 255
00181760: 94c70002 lhu r7,0x0002(r6)                   load units CT
00181764: 00000000 nop
00181768: 00e5102a slt r2,r7,r5			set if units CT < (CT + 1)* 128
0018176c: 1440000d bne r2,r0,0x001817a4               branch if next unit after ability
00181770: 00000000 nop
00181774: 14a70009 bne r5,r7,0x0018179c               branch if not same CT
00181778: 00000000 nop
0018177c: 14830003 bne r4,r3,0x0018178c		branch if Unit ID <> Unit ID in AT list
00181780: 0064102a slt r2,r3,r4			r2 = 1 if AT list Unit ID < Unit ID?
00181784: 15200005 bne r9,r0,0x0018179c		branch if unit is mounted (no valid turns?)
00181788: 00000000 nop
0018178c: 10400003 beq r2,r0,0x0018179c		Branch if unit had a turn before...?
00181790: 00000000 nop
00181794: 15200003 bne r9,r0,0x001817a4		branch if unit is mounted? (again?)
00181798: 00000000 nop
0018179c: 080605ee j 0x001817b8
001817a0: 310200ff andi r2,r8,0x00ff			return number of turns before resolution
001817a4: 25080001 addiu r8,r8,0x0001			#entries in AT list
001817a8: 29020028 slti r2,r8,0x0028			limit = 0x28
001817ac: 1440ffe6 bne r2,r0,0x00181748			Check next unit in AT list, 0x28 times (AT list limit is 40 bytes? 10 units?)
001817b0: 24c60004 addiu r6,r6,0x0004			AT list + 4
001817b4: 340200ff ori r2,r0,0x00ff
001817b8: 03e00008 jr r31
001817bc: 00000000 nop