Transfer Halfword Values

From Final Fantasy Hacktics Wiki
Revision as of 19:36, 15 April 2023 by Orkney (talk | contribs)
Jump to navigation Jump to search
Transfer r6/2 Halfwords from r5 to r4
-------------------------------------------
Parameters : r4 - Destination pointer
             r5 - Origin pointer
             r6 - Nb of byte to transfer

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 - Nb of bytes becomes Nb of halfwords
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:
001941c8:
001941d8:
00195c1c: AI Ability Data Setting
00195edc:
00195f04:
001960c0:
00196c70:
00197064:
00197090:
00197180:
00197714:
001978c0:
00198448:
00198a90:
0019b468:
0019b8e8:
0019bd5c:
0019c45c:
0019cb84:
0019d360:
0019e320:
0019e4ec: