Difference between revisions of "Sort target list"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
m
 
Line 1: Line 1:
<font face='Courier New'>
+
 
 
  r4 = target ID
 
  r4 = target ID
 +
Erase unit ID from target list, shifting all the remaining units
 
  --------------------------------
 
  --------------------------------
  0018ed7c: 00001821 addu r3,r0,r0
+
  0018ed7c: 00001821 addu r3,r0,r0           |{{f/std|<nowiki>r3 = 0x00</nowiki>}}
  0018ed80: 308400ff andi r4,r4,0x00ff
+
  0018ed80: 308400ff andi r4,r4,0x00ff       |{{f/std|<nowiki>r4 = Target ID last bytes</nowiki>}}
  0018ed84: 3c068019 lui r6,0x8019
+
  0018ed84: 3c068019 lui r6,0x8019           |
  0018ed88: 24c63877 addiu r6,r6,0x3877
+
  0018ed88: 24c63877 addiu r6,r6,0x3877       |{{f/std|<nowiki>r6 = End of target list</nowiki>}}
  0018ed8c: 340500ff ori r5,r0,0x00ff
+
  0018ed8c: 340500ff ori r5,r0,0x00ff         |{{f/std|<nowiki>r5 = 0xff</nowiki>}}
  0018ed90: 3c018019 lui r1,0x8019
+
  0018ed90: 3c018019 lui r1,0x8019           {{f/bloop|<nowiki> LOOP 1 - Seek target in target list</nowiki>}}
  0018ed94: 00230821 addu r1,r1,r3
+
  0018ed94: 00230821 addu r1,r1,r3                 |{{f/std|<nowiki>r1 = 0x8019 + loop counter</nowiki>}}
  0018ed98: 90223868 lbu r2,0x3868(r1)
+
  0018ed98: 90223868 lbu r2,0x3868(r1)             |{{f/load|<nowiki>r2 = Target list beginning + loop counter</nowiki>}}
  0018ed9c: 00000000 nop
+
  0018ed9c: 00000000 nop                           |{{f/std|<nowiki> </nowiki>}}
  0018eda0: 1444000f bne r2,r4,0x0018ede0 branch if target not hit by ability
+
  0018eda0: 1444000f bne r2,r4,0x0018ede0         {{f/Cond|<nowiki>if unit ID in target list = target ID</nowiki>}}  /Else branch to next loop
  0018eda4: 2862000f slti r2,r3,0x000f set if counter in bounds
+
  0018eda4: 2862000f slti r2,r3,0x000f                 |{{f/std|<nowiki>r2 = 0x01 while counter < 0x0f</nowiki>}}
  0018eda8: 1040000b beq r2,r0,0x0018edd8 branch if not
+
  0018eda8: 1040000b beq r2,r0,0x0018edd8             {{f/Cond|<nowiki>if counter < 0x0f</nowiki>}} /Else branch to jump to {{f/loc|<nowiki>end</nowiki>}}
  0018edac: 00000000 nop
+
  0018edac: 00000000 nop                                   |
  0018edb0: 3c018019 lui r1,0x8019
+
  0018edb0: 3c018019 lui r1,0x8019                         {{f/bloop|<nowiki> LOOP2 - Shift unit ID in target list (removing target ID)</nowiki>}}
  0018edb4: 00230821 addu r1,r1,r3
+
  0018edb4: 00230821 addu r1,r1,r3                             |{{f/std|<nowiki>r1 = 0x8019 + loop1 counter (= target position in target list)</nowiki>}}
  0018edb8: 90223869 lbu r2,0x3869(r1)
+
  0018edb8: 90223869 lbu r2,0x3869(r1)                         |
  0018edbc: 3c018019 lui r1,0x8019
+
  0018edbc: 3c018019 lui r1,0x8019                             |{{f/std|<nowiki>r2 = unit ID in target list just after Target</nowiki>}}
  0018edc0: 00230821 addu r1,r1,r3
+
  0018edc0: 00230821 addu r1,r1,r3                             |{{f/std|<nowiki>r1 = 0x8019 + loop1 counter (= target position in target list)</nowiki>}}
  0018edc4: a0223868 sb r2,0x3868(r1) sort target list
+
  0018edc4: a0223868 sb r2,0x3868(r1)                         |{{f/store|<nowiki>Shift unit ID in place of target ID</nowiki>}}
  0018edc8: 24630001 addiu r3,r3,0x0001
+
  0018edc8: 24630001 addiu r3,r3,0x0001                       |{{f/std|<nowiki>counter +1</nowiki>}}
  0018edcc: 2862000f slti r2,r3,0x000f
+
  0018edcc: 2862000f slti r2,r3,0x000f                         |{{f/std|<nowiki>r2 = 0x01 if r3 < 0x0f</nowiki>}}
  0018edd0: 1440fff7 bne r2,r0,0x0018edb0
+
  0018edd0: 1440fff7 bne r2,r0,0x0018edb0                 {{f/eloop|<nowiki> Loop if counter < 0x0f </nowiki>}}
  0018edd4: 00000000 nop
+
  0018edd4: 00000000 nop                                   |
  0018edd8: 08063b7c j 0x0018edf0 jump to end
+
  0018edd8: 08063b7c j 0x0018edf0                     {{f/Cond|<nowiki>E  </nowiki>}} {{f/jump|<nowiki> jump to </nowiki>{{f/loc|<nowiki>end</nowiki>}}<nowiki></nowiki>}}
  0018eddc: a0c50000 sb r5,0x0000(r6) store 0xff
+
  0018eddc: a0c50000 sb r5,0x0000(r6)                     |{{f/store|<nowiki>store 0xff at the end of the list (erase last unit ID ?)</nowiki>}}
  0018ede0: 24630001 addiu r3,r3,0x0001
+
  0018ede0: 24630001 addiu r3,r3,0x0001           |{{f/std|<nowiki>counter +1</nowiki>}}
  0018ede4: 28620010 slti r2,r3,0x0010
+
  0018ede4: 28620010 slti r2,r3,0x0010             |{{f/std|<nowiki>r2 = 0x01 if counter <= 0x0F</nowiki>}}
  0018ede8: 1440ffe9 bne r2,r0,0x0018ed90
+
  0018ede8: 1440ffe9 bne r2,r0,0x0018ed90     {{f/eloop|<nowiki>Loop if counter <= 0x0F</nowiki>}}
  0018edec: 00000000 nop
+
  0018edec: 00000000 nop                    
  0018edf0: 03e00008 jr r31
+
  0018edf0: 03e00008 jr r31                  
  0018edf4: 00000000 nop
+
  0018edf4: 00000000 nop                    
'''Return Locations
+
==Return Locations==
  0018ba44: [[Set some data for current attack]]
+
  0018bb24: [[Set some data for current attack]]
</font>
 

Latest revision as of 20:31, 16 November 2021

r4 = target ID
Erase unit ID from target list, shifting all the remaining units
--------------------------------
0018ed7c: 00001821 addu r3,r0,r0            |r3 = 0x00
0018ed80: 308400ff andi r4,r4,0x00ff        |r4 = Target ID last bytes
0018ed84: 3c068019 lui r6,0x8019            |
0018ed88: 24c63877 addiu r6,r6,0x3877       |r6 = End of target list
0018ed8c: 340500ff ori r5,r0,0x00ff         |r5 = 0xff
0018ed90: 3c018019 lui r1,0x8019            @ LOOP 1 - Seek target in target list
0018ed94: 00230821 addu r1,r1,r3                 |r1 = 0x8019 + loop counter
0018ed98: 90223868 lbu r2,0x3868(r1)             |r2 = Target list beginning + loop counter
0018ed9c: 00000000 nop                           | 
0018eda0: 1444000f bne r2,r4,0x0018ede0          #if unit ID in target list = target ID  /Else branch to next loop
0018eda4: 2862000f slti r2,r3,0x000f                 |r2 = 0x01 while counter < 0x0f
0018eda8: 1040000b beq r2,r0,0x0018edd8              #if counter < 0x0f /Else branch to jump to end
0018edac: 00000000 nop                                   |
0018edb0: 3c018019 lui r1,0x8019                         @ LOOP2 - Shift unit ID in target list (removing target ID)
0018edb4: 00230821 addu r1,r1,r3                             |r1 = 0x8019 + loop1 counter (= target position in target list)
0018edb8: 90223869 lbu r2,0x3869(r1)                         |
0018edbc: 3c018019 lui r1,0x8019                             |r2 = unit ID in target list just after Target
0018edc0: 00230821 addu r1,r1,r3                             |r1 = 0x8019 + loop1 counter (= target position in target list)
0018edc4: a0223868 sb r2,0x3868(r1)                          |Shift unit ID in place of target ID
0018edc8: 24630001 addiu r3,r3,0x0001                        |counter +1
0018edcc: 2862000f slti r2,r3,0x000f                         |r2 = 0x01 if r3 < 0x0f
0018edd0: 1440fff7 bne r2,r0,0x0018edb0                  Λ  Loop if counter < 0x0f 
0018edd4: 00000000 nop                                   |
0018edd8: 08063b7c j 0x0018edf0                      #E   >> jump to end
0018eddc: a0c50000 sb r5,0x0000(r6)                      |store 0xff at the end of the list (erase last unit ID ?)
0018ede0: 24630001 addiu r3,r3,0x0001            |counter +1
0018ede4: 28620010 slti r2,r3,0x0010             |r2 = 0x01 if counter <= 0x0F
0018ede8: 1440ffe9 bne r2,r0,0x0018ed90     Λ Loop if counter <= 0x0F
0018edec: 00000000 nop                      
0018edf0: 03e00008 jr r31                   
0018edf4: 00000000 nop                      

Return Locations

0018bb24: Set some data for current attack