SAT64 ACC:P
6-315
Example
; Add 64-bit VarA, VarB and VarC, sat and store result in VarD:
ZAP OVC ; Clear overflow counter
MOVL P,@VarA+0 ; Load P with low 32-bits of VarA
ADDUL P,@VarB+0 ; Add to P unsigned low 32-bits of VarB
ADDUL P,@VarC+0 ; Add to P unsigned low 32-bits of VarC
MOVU @AL,OVC ; Store overlow (repeated carry) in the ACC
; and then add higher portion of the 64 bit
; variables
MOVB AH,#0 ; Store overlow (repeated carry) in the ACC
; and then add higher portion of the 64 bit
; variables
ZAP OVC ; Clear overflow counter
ADDL ACC,@VarA+2 ; Add to ACC with carry high 32-bits of VarA
ADDL ACC,@VarB+2 ; Add to ACC with carry high 32-bits of VarB
ADDL ACC,@VarC+2 ; Add to ACC with carry high 32-bits of VarC
SAT64 ACC:P ; Saturate ACC:P based on OVC value
MOVL @VarD+0,P ; Store low 32-bit result into VarD
MOVL @VarD+2,ACC ; Store high 32-bit result into VarD