I've come across both of these instructions in the The Intel 64 and 32 Bit Architectures Software Developer Manual, and am simply wondering what the differences between the two are, and when I should use one of them over the other.
The MOVS
instruction is generally intended to be used more than once since it automatically increments or decrements the values of edi
and esi
. Increment or decrement depends on if the Direction flag is clear or set, respectively. This can be used with the REP
prefix to make it repeat by decrementing ecx
until it hits zero.
According to some documentation that I read, the history of the movs
instruction was to move strings one byte at a time, though you can have it move larger items (words and quadwords, specifically). It will automatically change edi
and esi
by the correct amount, but it will still only decrement ecx
by one, so be careful if you are moving unicode strings, for example.
The page at http://x86.renejeschke.de/html/file_module_x86_id_279.html explains the exact conditions for the rep
prefix and its variants.