CLD: Clear Direction Flag

For information about interpreting this page, see the help page.
Opcode and MnemonicEncoding16 bit Mode32 bit Mode64 bit ModeDescription
FC
CLD
ZOValidValidValidClear the DF flag.

Encoding

EncodingOperand
ZONone

Description

The CLD instruction clears the DF (direction) flag in the EFLAGS register.

The direction flag controls the direction of string operations such as MOVS. When clear, string operations will increment the index registers (ESI and/or EDI) during operation. When set, they will be decremented instead.

Operation

This pseudo-code uses C# syntax. A list of the types used is available here.
public void CLD()
{
  DF = 0;
}

Flags Affected

CF (carry flag)
Unmodified.
PF (parity flag)
Unmodified.
AF (auxiliary flag)
Unmodified.
ZF (zero flag)
Unmodified.
SF (sign flag)
Unmodified.
OF (overflow flag)
Unmodified.

Exceptions

Protected Mode

#UD
If the LOCK prefix is used.

Real-Address Mode

#UD
If the LOCK prefix is used.

Virtual-8086 Mode

#UD
If the LOCK prefix is used.

Compatibility Mode

#UD
If the LOCK prefix is used.

Long Mode

#UD
If the LOCK prefix is used.