This articleneeds additional citations forverification. Please helpimprove this article byadding citations to reliable sources. Unsourced material may be challenged and removed. Find sources: "Direction flag" – news ·newspapers ·books ·scholar ·JSTOR(December 2018) (Learn how and when to remove this message) |
Thedirection flag is aflag that controls theleft-to-right orright-to-left direction ofstring processing,[1] stored in theFLAGS register on allx86-compatibleCPUs.[2] It isbit number 10.
This flag is used to determine the direction ('forward' or 'backward') in which several bytes of data will be copied from one place in thememory, to another. The direction is important mainly when the original data position in memory and the target data position overlap.
CLD
) — it means that string is processed beginning from lowest to highestaddress; suchinstructions mode is calledauto-incrementing mode. Both thesource index anddestination index (likeMOVS
) will increase them;STD
) — the string is processed from highest to lowest address. This is calledauto-decrementing mode.x86-instruction | Meaning | Flag | Notes | |
---|---|---|---|---|
Direction of string processing | Mode title | |||
CLD | clear direction flag | 0 | lowest-to-highestaddress | auto-incrementing |
STD | set direction flag | 1 | highest-to-lowest address | auto-decrementing |