Direction flag
   HOME

TheInfoList



OR:

The direction flag is a flag that controls the ''left-to-right'' or ''right-to-left'' direction of string processing, stored in the
FLAGS register The FLAGS register is the status register that contains the current state of a x86 CPU. The size and meanings of the flag bits are architecture dependent. It usually reflects the result of arithmetic operations as well as information about restric ...
on all
x86 x86 (also known as 80x86 or the 8086 family) is a family of complex instruction set computer (CISC) instruction set architectures initially developed by Intel based on the Intel 8086 microprocessor and its 8088 variant. The 8086 was intr ...
-compatible CPUs.Direction Flag
at
MSDN Microsoft Developer Network (MSDN) was the division of Microsoft responsible for managing the firm's relationship with developers and testers, such as hardware developers interested in the operating system (OS), and software developers developing ...
It is bit 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 the
memory Memory is the faculty of the mind by which data or information is encoded, stored, and retrieved when needed. It is the retention of information over time for the purpose of influencing future action. If past events could not be remembered ...
, 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 An address is a collection of information, presented in a mostly fixed format, used to give the location of a building, apartment, or other structure or a plot of land, generally using political boundaries and street names as references, along ...
; such
instructions Instruction or instructions may refer to: Computing * Instruction, one operation of a processor within a computer architecture instruction set * Computer program, a collection of instructions Music * Instruction (band), a 2002 rock band from Ne ...
mode is called ''auto-incrementing'' mode. Both the source index and destination index (like MOVS) 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.


References

{{X86 assembly topics X86 architecture