ABS ACC
6-19
ABS ACC Absolute Value of Accumulator
SYNTAX OPTIONS OPCODE OBJMODE RPT CYC
ABS ACC 1111 1111 0101 0110 X − 1
Operands ACC Accumulator register
Description The content of the ACC register is replaced with its absolute value:
if(ACC = 0x8000 0000)
V = 1;
If (OVM = 1)
ACC = 0x7FFF FFFF;
else
ACC = 0x8000 0000;
else
if(ACC < 0)
ACC = −ACC;
Flags and
N After the operation, the N flag is set if bit 31 of the ACC is 1, else N is cleared.
Modes
Z After the operation, the Z flag is set if the ACC is zero, else Z is cleared.
C C is cleared by this operation.
V If (ACC = 0x8000 0000) at the start of the operation, this is considered an
overflow value and V is set. Otherwise, V is not affected.
OVM If (ACC = 0x8000 0000) at the start of the operation, this is considered an
overflow value, and the ACC value after the operation depends on the state
of OVM: If OVM is cleared, ACC will be filled with 0x8000 0000. If OVM is set
ACC will be saturated to 0x7FFF FFFF.
Repeat This instruction is not repeatable. If this instruction follows the RPT
instruction, it resets the repeat counter (RPTC) and executes only once.
Example
; Take absolute value of VarA, make sure value is saturated:
MOVL ACC,@VarA ; Load ACC with contents of VarA
SETC OVM ; Turn overflow mode on
ABS ACC ; Absolute of ACC and saturate
MOVL @VarA,ACC ; Store result into VarA