Difference between revisions of "Get unit misc data that matches r4 ID"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
m
(Undo revision 20693 by Orkney (talk))
Tag: Undo
Line 1: Line 1:
 
  Need r4 = Unit X ID
 
  Need r4 = Unit X ID
  Return r2 = Unit ID / If not found = 0x00
+
  Return r2 = Unit X data pointer / If not found = 0x00
 
  ------------------------------------------
 
  ------------------------------------------
 
  0007a724: 3c03800a lui r3,0x800a
 
  0007a724: 3c03800a lui r3,0x800a

Revision as of 19:20, 17 June 2021

Need r4 = Unit X ID
Return r2 = Unit X data pointer / If not found = 0x00
------------------------------------------
0007a724: 3c03800a lui r3,0x800a
0007a728: 8c638a54 lw r3,-0x75ac(r3)           r3 = pointer to last units misc data? ( 0x80098a54 ) 
0007a72c: 00000000 nop
0007a730: 1060000e beq r3,r0,0x0007a76c        #If r3 <> 0x00  (skip if unit is the first unit ?) / Else branch to END
0007a734: 00001021 addu r2,r0,r0                   |return r2 = 0
0007a738: 3084ffff andi r4,r4,0xffff               |r4 = r4 last 2 bytes
0007a73c: 8c620134 lw r2,0x0134(r3)                @  r2 = units data ( 0x80098b88 ) 
0007a740: 00000000 nop                        
0007a744: 10400005 beq r2,r0,0x0007a75c                #If r2 <> 0x00 - Else branch (scan previous unit)
0007a748: 00000000 nop                                     |
0007a74c: 9042018a lbu r2,0x018a(r2)                       |r2 = unit ID (unit data 0x018a )
0007a750: 00000000 nop                                     |
0007a754: 10440005 beq r2,r4,0x0007a76c                    #If r2 <> r4 (Inherited unit ID from call) / Else branch to END (with r2 = r4's unit pointer) if unit ID is the last unit ID?
0007a758: 00601021 addu r2,r3,r0			    |r2 = r3 (=r4's unit data pointer)
0007a75c: 8c630000 lw r3,0x0000(r3)                    E#      |load previous units misc data
0007a760: 00000000 nop                                         |
0007a764: 1460fff5 bne r3,r0,0x0007a73c            >step back until first unit is reached
0007a768: 00001021 addu r2,r0,r0                      |return r2 = 0?
0007a76c: 03e00008 jr r31
0007a770: 00000000 nop

Return location

00068ea8: Special_Status_Flag_Enabling?