fbpx
Wikipedia

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 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.
x86-instruction Meaning Flag Notes
Direction

of string processing

Mode title
CLD clear direction flag 0 lowest-to-highest address auto-incrementing
STD set direction flag 1 highest-to-lowest address auto-decrementing

References Edit

  1. ^ 3.8.1 Carry and Direction Flag Control Instructions
  2. ^ Direction Flag at MSDN

direction, flag, this, article, needs, additional, citations, verification, please, help, improve, this, article, adding, citations, reliable, sources, unsourced, material, challenged, removed, find, sources, news, newspapers, books, scholar, jstor, december, . This article needs additional citations for verification Please help improve this article by adding 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 template message 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 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 x86 instruction Meaning Flag NotesDirection of string processing Mode titleCLD clear direction flag 0 lowest to highest address auto incrementingSTD set direction flag 1 highest to lowest address auto decrementingReferences Edit 3 8 1 Carry and Direction Flag Control Instructions Direction Flag at MSDN Retrieved from https en wikipedia org w index php title Direction flag amp oldid 971887103, wikipedia, wiki, book, books, library,

article

, read, download, free, free download, mp3, video, mp4, 3gp, jpg, jpeg, gif, png, picture, music, song, movie, book, game, games.