Top Qs
Timeline
Chat
Perspective
Direction flag
From Wikipedia, the free encyclopedia
Remove ads
Remove ads
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 number 10.
This article needs additional citations for verification. (December 2018) |
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.
- If it is set to 0 (using the clear-direction-flag instruction
CLD
) — it means that string is processed beginning from lowest to highest address; such instructions mode is called auto-incrementing mode. Both the source index and destination index (likeMOVS
) will increase them; - In case it is set to 1 (using the set-direction-flag instruction
STD
) — the string is processed from highest to lowest address. This is called auto-decrementing mode.
Remove ads
References
Wikiwand - on
Seamless Wikipedia browsing. On steroids.
Remove ads