Difference between revisions of "Transfer Halfword Values"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
m
 
(4 intermediate revisions by 2 users not shown)
Line 3: Line 3:
 
  Parameters : r4 - Destination pointer
 
  Parameters : r4 - Destination pointer
 
               r5 - Origin pointer
 
               r5 - Origin pointer
               r6 - Nb of byte to transfer
+
               r6 - Limit (x2)
+
 
 
  Returns nothing
 
  Returns nothing
 
  -------------------------------------------
 
  -------------------------------------------
Line 10: Line 10:
 
  0019ab0c: 000617c2 srl r2,r6,0x1f           
 
  0019ab0c: 000617c2 srl r2,r6,0x1f           
 
  0019ab10: 00461021 addu r2,r2,r6            |{{f/std|Round r6 up if needed}}
 
  0019ab10: 00461021 addu r2,r2,r6            |{{f/std|Round r6 up if needed}}
  0019ab14: 00023043 sra r6,r2,0x01          |{{f/std|Limit / 2 - Nb of bytes becomes Nb of halfwords}}
+
  0019ab14: 00023043 sra r6,r2,0x01          |{{f/std|Limit / 2 }}
 
  0019ab18: 18c00008 blez r6,0x0019ab3c      {{f/Cond|If Limit is valid (> 0)}}
 
  0019ab18: 18c00008 blez r6,0x0019ab3c      {{f/Cond|If Limit is valid (> 0)}}
 
  0019ab1c: 00001821 addu r3,r0,r0                |{{f/std|<nowiki>Counter = 0</nowiki>}}
 
  0019ab1c: 00001821 addu r3,r0,r0                |{{f/std|<nowiki>Counter = 0</nowiki>}}
Line 26: Line 26:
 
=== Return locations ===
 
=== Return locations ===
 
  '''Battle.bin'''
 
  '''Battle.bin'''
  0019418c:
+
  0019418c: [[Main_AI_action_setup]]
  001941c8:
+
  001941c8: [[Main_AI_action_setup]]
  001941d8:
+
  001941d8: [[Main_AI_action_setup]]
 
  00195c1c: [[ AI Ability Data Setting]]
 
  00195c1c: [[ AI Ability Data Setting]]
  00195edc:
+
  00195edc: [[00195d94_-_00195f68]]
  00195f04:
+
  00195f04: [[00195d94_-_00195f68]]
 
  001960c0:
 
  001960c0:
 
  00196c70:
 
  00196c70:
  00197064:
+
  00197064: [[Compare_Set_Highest_Unit_Target_Priority_(00196fc4)]]
  00197090:
+
  00197090: [[Compare_Set_Highest_Unit_Target_Priority_(00196fc4)]]
 
  00197180:
 
  00197180:
 
  00197714:
 
  00197714:
Line 46: Line 46:
 
  0019c45c:
 
  0019c45c:
 
  0019cb84:
 
  0019cb84:
  0019d360:
+
  0019d360: [[Check_Set_Highest_Unit_Priority_(0019d308)]]
 
  0019e320:
 
  0019e320:
 
  0019e4ec:
 
  0019e4ec:

Latest revision as of 21:23, 20 March 2024

Transfer r6/2 Halfwords from r5 to r4
-------------------------------------------
Parameters : r4 - Destination pointer
             r5 - Origin pointer
             r6 - Limit (x2)
Returns nothing
-------------------------------------------
0019ab08: 27bdfff8 addiu r29,r29,-0x0008    
0019ab0c: 000617c2 srl r2,r6,0x1f           
0019ab10: 00461021 addu r2,r2,r6            |Round r6 up if needed
0019ab14: 00023043 sra r6,r2,0x01           |Limit / 2 
0019ab18: 18c00008 blez r6,0x0019ab3c       #If Limit is valid (> 0)
0019ab1c: 00001821 addu r3,r0,r0                |Counter = 0
                                                @Loop - Transfer halfwords from r5 to r3
0019ab20: 94a20000 lhu r2,0x0000(r5)                |Load Halfword
0019ab24: 24a50002 addiu r5,r5,0x0002               |Origin pointer + 2
0019ab28: 24630001 addiu r3,r3,0x0001               |Counter + 1
0019ab2c: a4820000 sh r2,0x0000(r4)                 |Store Data
0019ab30: 0066102a slt r2,r3,r6                     |check counter Vs limit
0019ab34: 1440fffa bne r2,r0,0x0019ab20         Λ Branch while Counter < Limit
0019ab38: 24840002 addiu r4,r4,0x0002               |Destination pointer + 2
0019ab3c: 27bd0008 addiu r29,r29,0x0008     END
0019ab40: 03e00008 jr r31
0019ab44: 00000000 nop

Return locations

Battle.bin
0019418c: Main_AI_action_setup
001941c8: Main_AI_action_setup
001941d8: Main_AI_action_setup
00195c1c: AI Ability Data Setting
00195edc: 00195d94_-_00195f68
00195f04: 00195d94_-_00195f68
001960c0:
00196c70:
00197064: Compare_Set_Highest_Unit_Target_Priority_(00196fc4)
00197090: Compare_Set_Highest_Unit_Target_Priority_(00196fc4)
00197180:
00197714:
001978c0:
00198448:
00198a90:
0019b468:
0019b8e8:
0019bd5c:
0019c45c:
0019cb84:
0019d360: Check_Set_Highest_Unit_Priority_(0019d308)
0019e320:
0019e4ec: