NOT Instruction
NOT instruction toggles (complements) all bits in an operand.
NOT — One's Complement Negation (Logical NOT) |
||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||||||||||||||||||||||||||||
NEG performs two's complement, which changes a binary value from positive to negative and vice versa by reversing the bits and adding 1. Typically, NOT is used on unsigned data and NEG on signed data.
NOT |
NEG |
Setting Zero Flag |
|---|---|---|
.code mov eax, 0 mov al, 00111010b not al call WriteHex |
.code mov eax, 0 mov al, 00111010b neg al call WriteHex |
.code
and al, 0
jz L1
call WaitMsg
L1: exit
|
| Output | Output | Output |
| Clearing Sign Flag | Setting Overflow Flag | Setting/Clearing Carry Flag |
.code
and al, 7Fh
js L1
call WaitMsg
L1: exit
|
.code
mov al, 7Fh
inc al
jo L1
call WaitMsg
L1: exit
|
.code
stc ; or clc
jc L1
call WaitMsg
L1: exit
|
| Output | Output | Output |