- Direction flag
-
The Direction Flag is a flag that controls the left-to-right or right-to-left direction of string processing[1] stored in the FLAGS register on all x86 compatible CPUs.[2] It is bit 10.
When it is set to 0 (using the clear-direction-flag instruction CLD),[3] 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),[4] 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, to another. The direction is important mainly when the original data position in memory and the target data position overlap.
References
Categories:- Computer arithmetic
- X86 architecture
Wikimedia Foundation. 2010.