Difference between revisions of "Assembler:Commands:NEG"
Jump to navigation
Jump to search
m |
|||
Line 4: | Line 4: | ||
The Neg instruction performs a Two's Complement Negation. Negating positive operand becomes negative. Negating negative operand becomes positive. Zero remains zero. | The Neg instruction performs a Two's Complement Negation. Negating positive operand becomes negative. Negating negative operand becomes positive. Zero remains zero. | ||
The two's complement of a number behaves like the negative of the original number. | The two's complement of a number behaves like the negative of the original number. | ||
+ | |||
+ | 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. | ||
Revision as of 00:40, 27 November 2017
command neg operand
The Neg instruction performs a Two's Complement Negation. Negating positive operand becomes negative. Negating negative operand becomes positive. Zero remains zero. The two's complement of a number behaves like the negative of the original number.
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.
Operand = -Operand
Replaces the value of operand (the destination operand) with its two's complement. (This operation is equivalent to subtracting the operand from 0.) The destination operand is located in a general-purpose register or a memory location.
Command Parameters
Parameter | Description |
---|---|
operand | The operand to perform a Negate operation on |
Examples
neg al
neg ah
neg ax
neg eax
neg rax
neg [edx+110]
neg [rdx+10]
neg [00123abc]
neg [UserDefinedSymbol]
See also