MOVSW
Usage: MOVSW dest,src Modifies flags: None
Copies word from location addressed by ESI (even if operands are given) to the location EDI 'dest' and updates ESI and EDI based on the size of the operand or instruction used. ESI and EDI are incremented when the Direction Flag is cleared and decremented when the Direction Flag is Set. Use with REP prefixes.
Move String
MOVSB ; A4 [8086]
MOVSW ; o16 A5 [8086]
MOVSD ; o32 A5 [386]
MOVSB copies the byte at ESI to EDI. It then increments or decrements (depending on the direction flag: increments if the flag is clear, decrements if it is set) ESI and EDI.
MOVSW and MOVSD work in the same way, but they copy a word or a doubleword instead of a byte, and increment or decrement the addressing registers by 2 or 4 instead of 1.
The REP prefix may be used to repeat the instruction CX (or ECX - again, the address size chooses which) times.
EXAMPLE:
While B$esi <> 0 | movsw | End_While