std

Set Direction Flag

STD

Sets DF to 1 (String operations decrement).

Details

Sets the Direction Flag (DF) to 1, causing string instructions (MOVS, SCAS, LODS, STOS, CMPS) to auto-decrement the index registers (ESI/EDI or RSI/RDI) rather than increment them. Only DF is modified; all other flags remain unchanged. Available in all modes.

Pseudocode Operation

DF ← 1

Example

STD

Encoding

Binary Layout
FD
+0
 
Format Legacy
Opcode FD
Extension Base

Operands

Reference (Intel® SDM)

Instruction Forms

Opcode Instruction Op/En 64/32-bit Mode CPUID Description
FD STD ZO Valid Valid Set DF flag.

Description

Sets the DF flag in the EFLAGS register. When the DF flag is set to 1, string operations decrement the index registers (ESI and/or EDI). Operation is the same in all modes.

Operation

DF := 1;

Flags Affected

The DF flag is set. The CF, OF, ZF, SF, AF, and PF flags are unaffected. Exceptions (All Operating Modes) #UD If the LOCK prefix is used. STD—Set Direction Flag Vol. 2B 4-672