x86 Assembly Language Reference Manual

Store String Data (stos)

stos{bwl}

Operation

store [AL|AX|EAX] -> ES:[(E)DI]

Description

Transfers the contents of the AL, AX, or EAX register to the memory byte or word addressed in the destination register relative to the ES segment. Before executing the move instruction, load the index values into the DI destination-index register.

The destination operand must be addressable from the ES register; it cannot span segments.

After the data is transferred, the destination-index register is automatically incremented or decremented as determined by the value of the direction flag (DF). The index registers are incremented if DF = 0 (DF cleared by a cld instruction); they are decremented if DF = 1 (DF set by a std instruction). The increment/decrement count is 1 for a byte move, 2 for a word, and 4 for a long.

For a block transfer of CX bytes, words or longs, precede a stos instruction with a rep prefix.

Example

Transfer the contents of the AL register to the memory byte addressed in the destination register, relative to the ES segment.

stosb

Transfer the contents of the AX register to the memory word addressed in the destination register, relative to the ES segment

stosw

Transfer the contents of the EAX register to the memory double-word addressed in the destination register, relative to the ES segment

stosl