ABS

Absolute value

ABS

ABSolute


[Syntax] ]

(1)ABS dest

(2)ABS src, dest

 

[Operation]

(1) if ( dest < 0 )

dest = -dest;

(2) if ( src < 0 )

dest = -src;

else

dest = src;

 

[Function]

-

(1)This instruction takes the absolute value of dest and places the result in dest.

-

(2)This instruction takes the absolute value of src and places the result in dest.

 

[Instruction Format]

Syntax

Processng Size

src

dest

Code size

(Byte)

ABS dest

L

-

Rd

2

ABS src, dest

L

Rs

Rd

3

[Flag Change]

Flag

C

Z

S

O

Change

 

 

 

Conditions

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

S : The flag is set when 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]

ABS R2

ABS R1, R2