Difference between revisions of "Assembler:Commands:NEG"

From Cheat Engine
Jump to navigation Jump to search
m
m
 
(3 intermediate revisions by the same user not shown)
Line 2: Line 2:
 
'''command''' neg ''operand''
 
'''command''' neg ''operand''
  
The Neg instruction performs a Two's Complement Negation.
+
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.
'''''Other ways to understand:'''''
 
 
 
- Operand subtracted from itself twice
 
 
 
- Operand subtracted from '0'
 
 
 
- The operand multiplied by '-1'
 
 
 
- Positive become Negative
 
 
 
- Negative become Positive
 
  
  
Line 24: Line 14:
 
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.
 
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.
  
[http://x86.renejeschke.de/html/file_module_x86_id_216.html x86.renejeschke.de/html/file_module_x86_id_216.html]
+
[https://c9x.me/x86/html/file_module_x86_id_216.html c9x.me/x86/html/file_module_x86_id_216.html]
 
</div>
 
</div>
  
Line 63: Line 53:
  
 
== External links ==
 
== External links ==
* [http://x86.renejeschke.de/ x86.renejeschke.de]
+
* [https://c9x.me/x86/ c9x.me/x86/]
 
* [http://ref.x86asm.net/ ref.x86asm.net]
 
* [http://ref.x86asm.net/ ref.x86asm.net]
 
* [https://wikipedia.org/wiki/X86_instruction_listings wikipedia.org/wiki/X86_instruction_listings]
 
* [https://wikipedia.org/wiki/X86_instruction_listings wikipedia.org/wiki/X86_instruction_listings]

Latest revision as of 02:53, 5 January 2018

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.

c9x.me/x86/html/file_module_x86_id_216.html


Command Parameters[edit]

Parameter Description
operand The operand to perform a Negate operation on


Examples[edit]

neg al
neg ah
neg ax
neg eax
neg rax
neg [edx+110]
neg [rdx+10]
neg [00123abc]
neg [UserDefinedSymbol]


See also[edit]


External links[edit]