I'm trying to write memmove in assembly: the problem is that in my section data I've got two line : source and destination, and when I'm trying to pass 20 byte from source to destination while source got just 15 byte the 16th byte that pass from source to destination need to be the first byte of destination but the first byte of source passed,
RAX
is on 21 then the data that need to pass is source+21
= 43,source+21
is 176(176 = source+0) and not 43 like it is supposed to be,RCX
there is source + 22
= 122(122= source+1) and suppose to be 161It's look like the code is cyclic , thanks for your help!
The source and destination arrays follow each other in memory. There's no gap between them.
The very first transfer that your copying loop does will read the first byte from source (176) and write it over the first byte of destination (43). Hereafter the value 43 is gone forever!
When you inspect source+21
, which is the same as destination+0
, only the value 176 remains.
The second transfer that your copying loop does will read the second byte from source (122) and write it over the second byte of destination (161). Hereafter the value 161 is gone forever!
When you inspect source+22
, which is the same as destination+1
, only the value 122 remains.