Difference between revisions of "0014a39c - 0014a3f4"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
m (Notes and links)
m
Line 2: Line 2:
 
  #return r2
 
  #return r2
 
     = 0xffff if r4 < 0x80
 
     = 0xffff if r4 < 0x80
     = five last nimbles of r4 if between 0x80 and 0x35F
+
     = five last bits of r4 if between 0x80 and 0x35F
     = three last nimbles of r4 and two 0 if r4 between 0x360 and 0x3FF
+
     = three last bits of r4 and two 0 if r4 between 0x360 and 0x3FF
 
     = ? If >= 0x400 (via [[0014c958_-_0014c990]])
 
     = ? If >= 0x400 (via [[0014c958_-_0014c990]])
 
  --------------------------------------------------------------------------
 
  --------------------------------------------------------------------------
Line 16: Line 16:
 
  0014a3bc: 28820400 slti r2,r4,0x0400                |r2 = 1 if r4<0x400
 
  0014a3bc: 28820400 slti r2,r4,0x0400                |r2 = 1 if r4<0x400
 
  0014a3c0: 080528f8 j 0x0014a3e0                          >>'''jump to nearly end'''
 
  0014a3c0: 080528f8 j 0x0014a3e0                          >>'''jump to nearly end'''
  0014a3c4: 3090001f andi r16,r4,0x001f                    |r16 = r4 five last nimbles
+
  0014a3c4: 3090001f andi r16,r4,0x001f                    |r16 = r4 five last bits
 
  0014a3c8: 10400003 beq r2,r0,0x0014a3d8              #'''if r4 is between 0x360 and 0x3FF'''
 
  0014a3c8: 10400003 beq r2,r0,0x0014a3d8              #'''if r4 is between 0x360 and 0x3FF'''
  0014a3cc: 30820007 andi r2,r4,0x0007                    |r2 = r4 three last nimbles
+
  0014a3cc: 30820007 andi r2,r4,0x0007                    |r2 = r4 three last bits
 
  0014a3d0: 080528f8 j 0x0014a3e0                          >>'''Jump to nearly end'''
 
  0014a3d0: 080528f8 j 0x0014a3e0                          >>'''Jump to nearly end'''
  0014a3d4: 00028080 sll r16,r2,0x02                      |r16 = r2 * 4 (five nimbles ending with two 0)
+
  0014a3d4: 00028080 sll r16,r2,0x02                      |r16 = r2 * 4 (five bits ending with two 0)
 
  0014a3d8: 0c053256 jal 0x0014c958                    |-->[[0014c958_-_0014c990|<span style="color:blue">0014c958_-_0014c990</span>]] '''jal if r4 > 0x400'''
 
  0014a3d8: 0c053256 jal 0x0014c958                    |-->[[0014c958_-_0014c990|<span style="color:blue">0014c958_-_0014c990</span>]] '''jal if r4 > 0x400'''
 
  0014a3dc: 00000000 nop                              |
 
  0014a3dc: 00000000 nop                              |

Revision as of 19:32, 2 September 2021

#Need r4 (0x00 from Run_Script_Variable_Command)
#return r2
   = 0xffff if r4 < 0x80
   = five last bits of r4 if between 0x80 and 0x35F
   = three last bits of r4 and two 0 if r4 between 0x360 and 0x3FF
   = ? If >= 0x400 (via 0014c958_-_0014c990)
--------------------------------------------------------------------------
0014a39c: 27bdffe8 addiu r29,r29,0xffe8          
0014a3a0: afb00010 sw r16,0x0010(r29)            
0014a3a4: 2410ffff addiu r16,r0,0xffff           |r16 = 0xffff
0014a3a8: 28820080 slti r2,r4,0x0080             
0014a3ac: 1440000c bne r2,r0,0x0014a3e0          #If r4>= 0x80 Else branch to end (keeping r16 = 0xffff)
0014a3b0: afbf0014 sw r31,0x0014(r29)            
0014a3b4: 28820360 slti r2,r4,0x0360             
0014a3b8: 10400003 beq r2,r0,0x0014a3c8              #if r4 < 0x360
0014a3bc: 28820400 slti r2,r4,0x0400                 |r2 = 1 if r4<0x400
0014a3c0: 080528f8 j 0x0014a3e0                          >>jump to nearly end
0014a3c4: 3090001f andi r16,r4,0x001f                    |r16 = r4 five last bits
0014a3c8: 10400003 beq r2,r0,0x0014a3d8              #if r4 is between 0x360 and 0x3FF
0014a3cc: 30820007 andi r2,r4,0x0007                     |r2 = r4 three last bits
0014a3d0: 080528f8 j 0x0014a3e0                          >>Jump to nearly end
0014a3d4: 00028080 sll r16,r2,0x02                       |r16 = r2 * 4 (five bits ending with two 0)
0014a3d8: 0c053256 jal 0x0014c958                    |-->0014c958_-_0014c990 jal if r4 > 0x400
0014a3dc: 00000000 nop                               |
0014a3e0: 02001021 addu r2,r16,r0                    |Return r2 as r16 value
0014a3e4: 8fbf0014 lw r31,0x0014(r29)                
0014a3e8: 8fb00010 lw r16,0x0010(r29)                
0014a3ec: 27bd0018 addiu r29,r29,0x0018              
0014a3f0: 03e00008 jr r31                            
0014a3f4: 00000000 nop

Return location

0014a0d8 : Run_Script_Variable_Command send r4 = 0x00