Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- iAPx86 - <b>neg negate flags: o d i t s z a p c</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
NEG             Negate                               Flags: O D I T S Z A P C
                                                            * - - - * * * * *
NEG destination

        Logic   destination . -destination      ; Two's complement

    NEG subtracts the destination operand from 0 and returns the
    result in the destination. This effectively produces the two's
    complement of the operand.


    Note:
    If the operand is zero, the carry flag is cleared; in all other
    cases, the carry flag is set.

    Attempting to negate a byte containing -128 or a word containing
    -32,768 causes no change to the operand and sets the Overflow
    Flag.

        Example:        test    dx,dx
                        jns     positive
                        neg     dx      ; negate
                        neg     ax      ;   doubleword
                        sbb     dx,0    ;   in dx:ax
                     positive:


    Opcode      Format
    F6 /3       NEG  r/m8,r8
    F7 /3       NEG  r/m16,r16
    F7 /3       NEG  r/m32,r32


    Length and timing
    Operands    Bytes   8088    186     286     386     486     Pentium
    reg          2       3       3       2       2       1       1   NP
    mem       2+d(0-2)  24+EA   13       7       6       3       3   NP

See Also: NOT TEST SBB CBW CWD Flags

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson