0007a7b8 - 0007a83c

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
#Parameters:
  #r4 = Misc Unit ID

#Returns:
  #r2 = 0 if invalid unit
      = 1 if ?
0007a7b8: 27bdffe8 addiu r29,r29,-0x0018
0007a7bc: afbf0010 sw r31,0x0010(r29)
0007a7c0: 0c01e9b9 jal 0x0007a6e4              #Find Current Misc Unit Data Pointer (external ID)?
0007a7c4: 3084ffff andi r4,r4,0xffff           #
0007a7c8: 00402821 addu r5,r2,r0               #r5 = Misc Unit Data Pointer
0007a7cc: 10a00017 beq r5,r0,0x0007a82c        #Branch if invalid Unit ID
0007a7d0: 00000000 nop                             #
0007a7d4: 3c03800a lui r3,0x800a                   #
0007a7d8: 24638a54 addiu r3,r3,-0x75ac             #r3 = Last Unit misc data pointer?
0007a7dc: 10600014 beq r3,r0,0x0007a830            #Branch if invalid Unit ID
0007a7e0: 00001021 addu r2,r0,r0                   #Return r2 = 0
0007a7e4: 8c620000 lw r2,0x0000(r3)                    #r2 = Pointer to next previous unit's misc data
0007a7e8: 00000000 nop                                 #
0007a7ec: 10450006 beq r2,r5,0x0007a808                #Branch if current unit is previous unit
0007a7f0: 00000000 nop                                     #
0007a7f4: 00401821 addu r3,r2,r0                           #r3 = pointer to previous unit's misc data
0007a7f8: 1460fffa bne r3,r0,0x0007a7e4                #^Loop if not first unit?
0007a7fc: 00001021 addu r2,r0,r0                           #r2 = 0
0007a800: 0801ea0c j 0x0007a830                            #Jump to End
0007a804: 00000000 nop                                     #
0007a808: 8ca20000 lw r2,0x0000(r5)                    #r2 = Pointer to previous unit's misc data
0007a80c: 3c04800a lui r4,0x800a                       #
0007a810: 24848a54 addiu r4,r4,-0x75ac                 #r4 = Last Unit misc data pointer?
0007a814: ac620000 sw r2,0x0000(r3)                    #Save ?
0007a818: 8c830000 lw r3,0x0000(r4)                    #r3 = ?
0007a81c: 34020001 ori r2,r0,0x0001                    #r2 = 1
0007a820: aca30000 sw r3,0x0000(r5)                    #Save ?
0007a824: 0801ea0c j 0x0007a830                        #Jump to END
0007a828: ac850000 sw r5,0x0000(r4)                    #Save ?
0007a82c: 00001021 addu r2,r0,r0               #r2 = 0 (fail case)

End:
0007a830: 8fbf0010 lw r31,0x0010(r29)
0007a834: 27bd0018 addiu r29,r29,0x0018
0007a838: 03e00008 jr r31
0007a83c: 00000000 nop