Difference between revisions of "Get unit data pointer"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
(Created page with " Get unit data pointer? 001810d4: 2c820015 sltiu r2,r4,0x0015 (r4 = 10) < 15 001810d8: 1040000c beq r2,r0,0x0018110c Skip if ? 001810dc: 00002821 addu r5,r0,r0 001810e0:...")
 
Line 1: Line 1:
 
  Get unit data pointer?
 
  Get unit data pointer?
  001810d4: 2c820015 sltiu r2,r4,0x0015 (r4 = 10) < 15
+
  001810d4: 2c820015 sltiu r2,r4,0x0015 ID < 21
  001810d8: 1040000c beq r2,r0,0x0018110c Skip if ?
+
  001810d8: 1040000c beq r2,r0,0x0018110c Skip if unit invalid
  001810dc: 00002821 addu r5,r0,r0
+
  001810dc: 00002821 addu r5,r0,r0 return invalid r5
  001810e0: 000410c0 sll r2,r4,0x03 R4*8?
+
  001810e0: 000410c0 sll r2,r4,0x03 ID*8
  001810e4: 00441023 subu r2,r2,r4 r4*8 - original r4
+
  001810e4: 00441023 subu r2,r2,r4 ID*7
  001810e8: 00021180 sll r2,r2,0x06 r2* 2^6
+
  001810e8: 00021180 sll r2,r2,0x06 ID*0x1c0
 
  001810ec: 3c038019 lui r3,0x8019
 
  001810ec: 3c038019 lui r3,0x8019
 
  001810f0: 246308cc addiu r3,r3,0x08cc unit data pointer
 
  001810f0: 246308cc addiu r3,r3,0x08cc unit data pointer
Line 13: Line 13:
 
  00181100: 14620002 bne r3,r2,0x0018110c branch if unit ID != ff
 
  00181100: 14620002 bne r3,r2,0x0018110c branch if unit ID != ff
 
  00181104: 00000000 nop
 
  00181104: 00000000 nop
  00181108: 00002821 addu r5,r0,r0 clear r5 (80192a0c) (did not clear,  action not taken, ramza, math skill, guts)
+
  00181108: 00002821 addu r5,r0,r0 clear r5 if unit ID doesn't exist.
 
  0018110c: 03e00008 jr r31
 
  0018110c: 03e00008 jr r31

Revision as of 09:47, 19 February 2022

Get unit data pointer?
001810d4: 2c820015 sltiu r2,r4,0x0015		ID < 21
001810d8: 1040000c beq r2,r0,0x0018110c		Skip if unit invalid
001810dc: 00002821 addu r5,r0,r0		return invalid r5
001810e0: 000410c0 sll r2,r4,0x03		ID*8
001810e4: 00441023 subu r2,r2,r4		ID*7
001810e8: 00021180 sll r2,r2,0x06		ID*0x1c0
001810ec: 3c038019 lui r3,0x8019
001810f0: 246308cc addiu r3,r3,0x08cc		unit data pointer
001810f4: 00432821 addu r5,r2,r3		r5 = current unit data pointer
001810f8: 90a30001 lbu r3,0x0001(r5)		r3 = unit ID
001810fc: 340200ff ori r2,r0,0x00ff
00181100: 14620002 bne r3,r2,0x0018110c		branch if unit ID != ff
00181104: 00000000 nop
00181108: 00002821 addu r5,r0,r0		clear r5 if unit ID doesn't exist.
0018110c: 03e00008 jr r31