NEG Instruction
NEG instruction (negate) reverses the sign of a number by converting the number to its two's complement.
NEG — Two's Complement Negation |
||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||||||||||||||||||||||||||||
NEG instruction causes the value of its operand to be replaced by its negative.
– X |
–[X + 0] |
– X |
.data X SWORD -1234h .code neg X movsx eax, X call WriteHex |
.data X SWORD 0EDCCh .code neg X+0 movsx eax, X call WriteHex |
.data X SWORD 0h, 0EDCCh .code mov ebx, OFFSET X neg [ebx] mov eax, [ebx] call WriteHex |
| Output | Output | Output |
|
“I’m not arguing, I’m just explaining why I’m right.” ― Unknown |