当前位置: 代码迷 >> 汇编语言 >> 关于jbe 的使用的一点疑惑。解决方法
  详细解决方案

关于jbe 的使用的一点疑惑。解决方法

热度:2865   发布时间:2013-02-26 00:00:00.0
关于jbe 的使用的一点疑惑。
JBE的转移条件是CF=1或AF=1.

xor   ax,ax
cmp   ax,0;[ax=0,所以有下面的看法]
jbe   ***


因为ax=0,所以没有借位,所以CF=0
AF是辅助,再两位减时,也没有借位,所以AF=0。

那么是不是就应该说,没有满足条件,就不跳了???

但是JBE翻译过来,又是小于或者等于就跳。因为满足等于,所以就跳。

当然实事上是跳,但是从上面的标志寄存器上分析,是不是就不应该跳呢???

------解决方案--------------------------------------------------------
还是从含义上去理解吧,小于等于则跳转。
------解决方案--------------------------------------------------------
做了一下实验,CF=0,ZF=1
应该是书上错了
jbe=jump if below or equal
------解决方案--------------------------------------------------------
Topic: Jump Conditions


Opcode Mnemonic Flags Checked Description
----------------------------------------------------------------------------

size 0010 JB/JNAE CF=1 Jump if below/not above or
equal (unsigned comparisons)
size 0011 JAE/JNB CF=0 Jump if above or equal/not
below (unsigned comparisons)
size 0110 JBE/JNA CF=1 or ZF=1 Jump if below or equal/not
above (unsigned comparisons)
size 0111 JA/JNBE CF=0 and ZF=0 Jump if above/not below or
equal (unsigned comparisons)
size 0100 JE/JZ ZF=1 Jump if equal (zero)
size 0101 JNE/JNZ ZF=0 Jump if not equal (not zero)
size 1100 JL/JNGE SF <> OF Jump if less/not greater or
equal (signed comparisons)
size 1101 JGE/JNL SF=OF Jump if greater or equal/not
less (signed comparisons)
size 1110 JLE/JNG ZF=1 or SF <> OF Jump if less or equal/not
greater (signed comparisons)
size 1111 JG/JNLE ZF=0 and SF=OF Jump if greater/not less or
equal (signed comparisons)
size 1000 JS SF=1 Jump if sign
size 1001 JNS SF=0 Jump if not sign
size 0010 JC CF=1 Jump if carry
size 0011 JNC CF=0 Jump if not carry
size 0000 JO OF=1 Jump if overflow
size 0001 JNO OF=0 Jump if not overflow
size 1010 JP/JPE PF=1 Jump if parity/parity even
size 1011 JNP/JPO PF=0 Jump if no parity/parity odd
----------------------------------------------------------------------------

NOTE: The size bits are 0111 for short jumps or 1000 for 80386/486
near jumps.
  相关解决方案