SAT ACC
6-313
SAT ACC Saturate Accumulator
SYNTAX OPTIONS OPCODE OBJMODE RPT CYC
SAT ACC 1111 1111 0101 0111 X − 1
Operands ACC Accumulator register
Description Saturate the ACC register to reflect the net overflow represented in the 6-bit
overflow counter (OVC):
if( OVC > 0 )
ACC = 0x7FFF FFFF;
V = 1;
if( OVC < 0 )
ACC = 0x8000 0000;
V = 1;
if( OVC = 0 )
ACC = unchanged;
OVC = 0;
Flags and
Modes
N After the operation, the N flag is set if bit 31 of the ACC is 1, else N is cleared.
Z After the operation, the Z flag is set if the ACC is zero, else Z is cleared.
C C is cleared.
V If (OVC != 0) at the start of the operation, V is set; otherwise, V is cleared
OVC If (OVC > 0) then ACC is saturated to its maximum positive value.
If (OVC < 0) then ACC is saturated to its maximum negative value.
if (OVC = 0) then ACC is not modified.
After the operation, OVC is cleared.
Repeat This instruction is not repeatable. If this instruction follows the RPT
instruction, it resets the repeat counter (RPTC) and executes only once.
Example
; Add VarA, VarB and VarC and saturate result and store in VarD:
ZAP OVC ; Clear overflow counter
MOVL ACC,@VarA ; Load ACC with contents of VarA
ADDL ACC,@VarB ; Add to ACC contents of VarB
ADDL ACC,@VarC ; Add to ACC contents of VarC
SAT ACC ; Saturate ACC based on OVC value
MOVL @VarD,ACC ; Store result into VarD