在x86的方向标志 [英] Direction Flag in x86
问题描述
我无法理解怎么做的 86
方向标志的工作。在我的演讲的文字说,它的递增或递减在来源或目标注册,但是这没有意义它的名字。有人可以解释它做什么?
I am unable to understand how does the direction flag work in x86
. The text in my lectures say that it increments or decrements the source or destination register but that does not make sense with its name. Can someone explain what it does?
推荐答案
这标志在字符串操作中使用,并指定字符串是否开始以较低的地址,并继续向高地址,反之亦然。
This flag is used in string operations, and specifies if strings begin at a low address and proceed to higher addresses or vice versa.
有关字符串指令, ECX
的迭代次数, DS:ESI
的源地址和 ES:EDI
的目的地(因此的取值的在 ESI
和 D 在 EDI
)。
For string instructions, ECX
has the number of iterations, DS:ESI
has the source address and ES:EDI
has the destination (hence the s in ESI
and the d in EDI
).
每次迭代之后, ECX
减一,而 ESI
和 EDI
要么递增或递减的单元尺寸(1字节操作,2字操作等),根据 EFLAGS.DF
。
After each iteration, ECX
is decremented by one, and ESI
and EDI
are either incremented or decremented by the element size (1 for byte operations, 2 for word operations etc) according to EFLAGS.DF
.
如果 EFLAGS.DF
是 0
, ESI
和 EDI
递增,否则他们递减。
If EFLAGS.DF
is 0
, ESI
and EDI
are incremented, otherwise they're decremented.
这篇关于在x86的方向标志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!