汇编语言命令 NEG
   作者:Zoologist 于2008-12-15上传 

Description
Replaces the value of operand (the destination operand) with its two!s complement. (This oper-
ation is equivalent to subtracting the operand from 0.) The destination operand is located in a
general-purpose register or a memory location.

Operation
IF DEST = 0
THEN CF <- 0
ELSE CF <- 1;
FI;
DEST <- (DEST)
Flags Affected
The CF flag set to 0 if the source operand is 0; otherwise it is set to 1. The OF, SF, ZF, AF, and
PF flags are set according to the result.

描述:将操作数转化为二进制补码(这个操作等同于从0减去操作数)。操作数可以存放在通用寄存器,或者内存中。

影响的标志位

如果源操作数是0,CF将置为0;否则将被设为1,OF, SF, ZF, AF, 和 PF 标志位将根据结果设定。

========================================================================================================

还记得书上说:正数的补码等于每一位取反(反码);零的补码是0;负数的补码等于每一位取反加一。

例子:

eax=1 ; neg eax ; eax=0FFFFFFFFh

eax=-1; neg eax ; eax=7FFFFFFFh


eax=-7; neg eax ; eax=7FFFFFF9h

eax=0; neg eax ; eax=0




<<<上一篇
欢迎访问AoGo汇编小站:http://www.aogosoft.com
下一篇>>>