Lesson plan

Direction flag

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 on all x86-compatible CPUs. 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, 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 (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.

Back to article

Article summary

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 on all x86-compatible CPUs. 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, 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 (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.

Key claims

No claims recorded.

Discussion questions

  1. Summarise the article in your own words. Which single claim would you verify first, and why?
  2. Which claim in this article is most likely to be revised as the sources update? How would you check its current status?
  3. If two sources disagreed about one of these facts, what would you need in order to trust one over the other?

Bibliography

No sources recorded.

Key claims and bibliography are generated from the same tracked claims and sources as the article page.