@instruction<EOL><INDENT>def NEG(cpu, dest):<DEDENT>
source = dest.read()<EOL>res = dest.write(-source)<EOL>cpu._calculate_logic_flags(dest.size, res)<EOL>cpu.CF = source != <NUM_LIT:0><EOL>cpu.AF = (res & <NUM_LIT>) != <NUM_LIT><EOL>
Two's complement negation.

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::

        IF DEST  =  0
        THEN CF  =  0
        ELSE CF  =  1;
        FI;
        DEST  =  - (DEST)

:param cpu: current CPU.
:param dest: destination operand.