instruction: CMP
comparing by subtraction
for unsigned numbers:
2 bits in the FLAGS register
ZF CF
= 1 0
> 0 0
< 0 1
for signed numbers:
3 bits in the FLAGS register
ZF OF SF
= 1 0 0
> 0 1/0 1/0
< 0 1/0 0/1
the way of examining overflow:
carry into MSB != carry out of MSB
if
a positive + a positive --> a negative
or
a negative + a negative --> a positive
an overflow is generated
if
a negative + a positive or a positive + a negative
there will be no overflow
本文地址:http://com.8s8s.com/it/it25700.htm