Slide 11.7: XOR instruction
Slide 11.9: TEST instruction
Home

NOT Instruction


The NOT instruction toggles (complements) all bits in an operand.

NOT — One's Complement Negation (Logical NOT)

Usage: NOT dest

Flag O D I S Z A P C
Result                

Inverts the bits of the “dest” operand forming the 1's complement.
Clocks
Operands 286 386 486 Size Bytes
reg 2 2 1 2
mem 7 6 3 2-4

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