STOSB
Usage: STOSB Modifies flags: None
Stores value in accumulator to location at ES:(E)DI (even if operand is given). 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, . It then increments or decrements EDI (depending on the direction flag: increments if the flag is clear, decrements if it is set) .
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:
L1: inc edi
std
rep movsb | stosb
cld
mov ebx 1 | jmp L3>