3-669
INSTRUCTION SET REFERENCE
STOS/STOSB/STOSW/STOSDStore String (Continued)
The STOS, STOSB, STOSW, and STOSD instructions can be preceded by the REP prefix for
block loads of ECX bytes, words, or doublewords. More often, however, these instructions are
used within a LOOP construct because data needs to be moved into the AL, AX, or EAX register
before it can be stored. Refer to REP/REPE/REPZ/REPNE /REPNZRepeat String Operation
Prefix in this chapter for a description of the REP prefix.
Operation
IF (byte store)
THEN
DEST
<
AL;
THEN IF DF = 0
THEN (E)DI
<
(E)DI + 1;
ELSE (E)DI
<
(E)DI 1;
FI;
ELSE IF (word store)
THEN
DEST
<
AX;
THEN IF DF = 0
THEN (E)DI
<
(E)DI + 2;
ELSE (E)DI
<
(E)DI 2;
FI;
ELSE (* doubleword store *)
DEST
<
EAX;
THEN IF DF = 0
THEN (E)DI
<
(E)DI + 4;
ELSE (E)DI
<
(E)DI 4;
FI;
FI;
FI;
Flags Affected
None.
Protected Mode Exceptions
#GP(0)
If the destination is located in a nonwritable segment.
If a memory operand effective address is outside the limit of the ES
segment.
If the ES register contains a null segment selector.
#PF(fault-code)If a page fault occurs.
#AC(0)
If alignment checking is enabled and an unaligned memory reference is
made while the current privilege level is 3.