Difference between revisions of "Transfer Halfword Values"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
(Created page with " Transfer Halfword Values 0019ab08: 27bdfff8 addiu r29,r29,0xfff8 0019ab0c: 000617c2 srl r2,r6,0x1f 0019ab10: 00461021 addu r2,r2,r6 0019ab14: 00023043 sra r6,r2,0x01 Lim...")
 
Line 1: Line 1:
  Transfer Halfword Values
+
  Transfer r6/2 Halfwords from r5 to r4
  0019ab08: 27bdfff8 addiu r29,r29,0xfff8
+
-------------------------------------------
  0019ab0c: 000617c2 srl r2,r6,0x1f
+
Parameters : r4 - Destination pointer
  0019ab10: 00461021 addu r2,r2,r6
+
              r5 - Origin pointer
  0019ab14: 00023043 sra r6,r2,0x01 Limit / 2
+
              r6 - Nb of byte to transfer
  0019ab18: 18c00008 blez r6,0x 0019ab3c Branch if Limit <= 0
+
  0019ab1c: 00001821 addu r3,r0,r0 Counter = 0
+
Returns nothing
  0019ab20: 94a20000 lhu r2,0x0000(r5) Load Data
+
-------------------------------------------
  0019ab24: 24a50002 addiu r5,r5,0x0002 Pointer += 2
+
  0019ab08: 27bdfff8 addiu r29,r29,-0x0008   
  0019ab28: 24630001 addiu r3,r3,0x0001 Counter ++
+
  0019ab0c: 000617c2 srl r2,r6,0x1f          
  0019ab2c: a4820000 sh r2,0x0000(r4) Store Data
+
  0019ab10: 00461021 addu r2,r2,r6           |{{f/std|Round r6 up if needed}}
  0019ab30: 0066102a slt r2,r3,r6
+
  0019ab14: 00023043 sra r6,r2,0x01           |{{f/std|Limit / 2 - Nb of bytes becomes Nb of halfwords}}
  0019ab34: 1440fffa bne r2,r0,0x 0019ab20 Branch if Counter < Limit
+
  0019ab18: 18c00008 blez r6,0x0019ab3c      {{f/Cond|If Limit is valid (> 0)}}
  0019ab38: 24840002 addiu r4,r4,0x0002 Pointer2 += 2
+
  0019ab1c: 00001821 addu r3,r0,r0               |{{f/std|<nowiki>Counter = 0</nowiki>}}
  0019ab3c: 27bd0008 addiu r29,r29,0x0008
+
                                                {{f/bloop|Loop - Transfer halfwords from r5 to r3}}
 +
  0019ab20: 94a20000 lhu r2,0x0000(r5)               |{{f/load|Load Halfword}}
 +
  0019ab24: 24a50002 addiu r5,r5,0x0002               |{{f/adr|Origin pointer + 2}}
 +
  0019ab28: 24630001 addiu r3,r3,0x0001               |{{f/std|Counter + 1}}
 +
  0019ab2c: a4820000 sh r2,0x0000(r4)                 |{{f/store|Store Data}}
 +
  0019ab30: 0066102a slt r2,r3,r6                     |{{f/std|check counter Vs limit}}
 +
  0019ab34: 1440fffa bne r2,r0,0x0019ab20        {{f/eloop|Branch while Counter < Limit}}
 +
  0019ab38: 24840002 addiu r4,r4,0x0002               |{{f/adr|Destination pointer + 2}}
 +
  0019ab3c: 27bd0008 addiu r29,r29,0x0008     END
 
  0019ab40: 03e00008 jr r31
 
  0019ab40: 03e00008 jr r31
 
  0019ab44: 00000000 nop
 
  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:

Revision as of 19:36, 15 April 2023

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: