Difference between revisions of "Assembler:Commands:NEG"
Jump to navigation
Jump to search
(Created page with 'Category:Assembler '''command''' neg ''operand'' The neg instruction will subtract the operand from itself twice. Example: <pre>1 - 1 = 0 0 - 1 = -1</pre> This is what n…') |
|||
Line 2: | Line 2: | ||
'''command''' neg ''operand'' | '''command''' neg ''operand'' | ||
− | The neg instruction | + | The neg instruction performs a Two's Complement Negation. |
+ | Other ways to understand: | ||
+ | |||
+ | - Operand subtracted from itself twice | ||
+ | |||
+ | - Operand subtracted from '0' | ||
+ | |||
+ | - The operand multiplied by '-1' | ||
+ | |||
+ | - Positive become negative | ||
+ | |||
+ | - Negative become Positive | ||
− | |||
<pre>1 - 1 = 0 | <pre>1 - 1 = 0 | ||
− | |||
0 - 1 = -1</pre> | 0 - 1 = -1</pre> | ||
− | |||
− | |||
Revision as of 02:26, 26 November 2017
command neg operand
The neg instruction performs a Two's Complement Negation.
Other ways to understand:
- Operand subtracted from itself twice
- Operand subtracted from '0'
- The operand multiplied by '-1'
- Positive become negative
- Negative become Positive
1 - 1 = 0 0 - 1 = -1
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