NEG

Two's complementation

NEG

NEGate


[Syntax]

(1)NEG dest

(2)NEG src, dest

 

[Operation]

(1)dest = -dest;

(2)dest = -src;

 

[Function]

-

(1)This instruction arithmetically inverts (takes the two's complement of) dest and places the result in dest.

-

(2)This instruction arithmetically inverts (takes the two's complement of) src and places the result in dest.

 

[Instruction Format]

Syntax

Processng Size

src

dest

Code size

(Byte)

(1)NEG dest

L

Rd

2

(2)NEG src, dest

L

Rs

Rd

3

[Flag Change]

Flag

C

Z

S

O

Change

 

 

 

 

Conditions

C : The flag is set if dest is 0 after the operation; otherwise it is cleared.

Z : The flag is set if dest is 0 after the operation; otherwise it is cleared.

S : The flag is set if the MSB of dest after the operation is 1; otherwise it is cleared.

O : (1) The flag is set if dest before the operation was 80000000h; otherwise it is cleared.

(2) The flag is set if src before the operation was 80000000h; otherwise it is cleared.

 

[Description Example]

NEG R1

NEG R1, R2