Intel 64 and IA-32 Architectures Software Developers Manual Volume 2B, Instruction Set Reference, N-Z

Vol. 2B 4-337
INSTRUCTION SET REFERENCE, N-Z
STOS/STOSB/STOSW/STOSD/STOSQ—Store String
Description
In non-64-bit and default 64-bit mode; stores a byte, word, or doubleword from the
AL, AX, or EAX register (respectively) into the destination operand. The destination
operand is a memory location, the address of which is read from either the ES:EDI or
ES:DI register (depending on the address-size attribute of the instruction and the
mode of operation). The ES segment cannot be overridden with a segment override
prefix.
At the assembly-code level, two forms of the instruction are allowed: the “explicit-
operands” form and the “no-operands” form. The explicit-operands form (specified
with the STOS mnemonic) allows the destination operand to be specified explicitly.
Here, the destination operand should be a symbol that indicates the size and location
of the destination value. The source operand is then automatically selected to match
the size of the destination operand (the AL register for byte operands, AX for word
operands, EAX for doubleword operands). The explicit-operands form is provided to
allow documentation; however, note that the documentation provided by this form
can be misleading. That is, the destination operand symbol must specify the correct
type (size) of the operand (byte, word, or doubleword), but it does not have to
specify the correct location. The location is always specified by the ES:(E)DI
Opcode Instruction
64-Bit
Mode
Compat/
Leg Mode Description
AA STOS m8 Valid Valid For legacy mode, store AL at address
ES:(E)DI; For 64-bit mode store AL at
address RDI or EDI.
AB STOS m16 Valid Valid For legacy mode, store AX at address
ES:(E)DI; For 64-bit mode store AX at
address RDI or EDI.
AB STOS m32 Valid Valid For legacy mode, store EAX at
address ES:(E)DI; For 64-bit mode
store EAX at address RDI or EDI.
REX.W + AB STOS m64 Valid N.E. Store RAX at address RDI or EDI.
AA STOSB Valid Valid For legacy mode, store AL at address
ES:(E)DI; For 64-bit mode store AL at
address RDI or EDI.
AB STOSW Valid Valid For legacy mode, store AX at address
ES:(E)DI; For 64-bit mode store AX at
address RDI or EDI.
AB STOSD Valid Valid For legacy mode, store EAX at
address ES:(E)DI; For 64-bit mode
store EAX at address RDI or EDI.
REX.W + AB STOSQ Valid N.E. Store RAX at address RDI or EDI.