STOSW
Usage: STOSW dest Modifies flags: None
Stores value in accumulator to location at ES:(E)DI (even if operand is given). (E)DI is incremented / decremented based on the size of the operand (or instruction format) and the state of the Direction Flag. Use with REP prefixes.
Store Byte to String
STOSB ; AA [8086]
STOSW ; o16 AB [8086]
STOSD ; o32 AB [386]
STOSB stores the byte in AL at EDI, and sets the flags accordingly. It then increments or decrements (depending on the direction flag: increments if the flag is clear, decrements if it is set) EDI.
STOSW and STOSD work in the same way, but they store the word in AX or the doubleword in EAX instead of the byte in AL, and increment or decrement the addressing registers by 2 or 4 instead of 1.
The REP prefix may be used to repeat the instruction ECX times.
EXAMPLE:
mov edi D$CodeSource
mov ax 0A0D, ecx 5
rep stosw
mov eax edi