Direction flag
Encyclopedia
The Direction Flag is a flag that controls the left-to-right or right-to-left direction of string processing
String (computer science)
In formal languages, which are used in mathematical logic and theoretical computer science, a string is a finite sequence of symbols that are chosen from a set or alphabet....

 stored in the FLAGS register on all x86 compatible CPUs. It is bit
Bit
A bit is the basic unit of information in computing and telecommunications; it is the amount of information stored by a digital device or other physical system that exists in one of two possible distinct states...

 10.

When it is set to 0 (using the clear-direction-flag instruction CLD
X86 instruction listings
The x86 instruction set has been extended several times, introducing wider registers and datatypes and/or new functionality.-x86 integer instructions:...

), it means that instructions that autoincrement the source index and destination index (like movs) will increase both of them. In case it is set to 1 (using the set-direction-flag instruction STD
X86 instruction listings
The x86 instruction set has been extended several times, introducing wider registers and datatypes and/or new functionality.-x86 integer instructions:...

), the instruction will decrease them.

This flag is used to determine the direction (forward or backward) in which several bytes of data will be copied from one place in the memory
Ram
-Animals:*Ram, an uncastrated male sheep*Ram cichlid, a species of freshwater fish endemic to Colombia and Venezuela-Military:*Battering ram*Ramming, a military tactic in which one vehicle runs into another...

, to another. The direction is important mainly when the original data position in memory and the target data position overlap.
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK