Transfer Halfword Values

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
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: