
SUBCUL ACC,loc32
6-348
Example 1
; Calculate unsigned: Quot32 = Num32/Den32, Rem32 = Num32%Den32
MOVB ACC,#0
; Zero ACC
MOVL P,@Num32
; Load P register with Num32
RPT #31
; Repeat operation 32 times
||SUBCUL ACC,@Den32
; Conditional subtract with Den32
MOVL @Rem32,ACC
; Store remainder in Rem32
MOVL @Quot32,P
; Store quotient in Quot32
Example 2
; Calculate signed: Quot32 = Num32/Den32, Rem32 = Num32%Den32
CLRC TC
; Clear TC flag, used as sign flag
MOVL ACC,@Den32
; Load ACC with contents of Den32
ABSTC ACC
; Take absolute value, TC = sign ^ TC
MOVL XT,@ACC
; Temp save denominator in XT register
MOVL ACC,@Num32
; Load ACC register with Num32
ABSTC ACC
; Take abs value, TC = sign ^ TC
MOVL P,@ACC
; Load P register with numerator
MOVB ACC,#0
; Zero ACC
RPT #31
; Repeat operation 32 times
||SUBCUL ACC,@XT
; Conditional subtract with denominator
MOVL @Rem32,ACC
; Store remainder in Rem32
MOVL ACC,@P
; Load ACC with quotient
NEGTC ACC
; Negate ACC if TC=1 (negative result)
MOVL @Quot32,ACC
; Store quotient in Quot32
Example 3
; Calculate unsigned: Quot64 = Num64Den32, Rem32 = Num64%Den32
MOVB ACC,#0
; Zero ACC
MOVL P,@Num64+2
; Load P with high 32-bits of Num64
RPT #31
; Repeat operation 32 times
||SUBCUL ACC,@Den32
; Conditional subtract with Den32
MOVL @2,P
; Store high 32 bit quotient in Quot64
MOVL P,@Num64+0
; Load P with low 32-bits of Num64
RPT #31
; Repeat operation 32 times
||SUBCUL ACC,@Den32
; Conditional subtract with Den32
MOVL @Rem32,ACC
; Store remainder in Rem32
MOVL @0,P
; Store low 32 bit quotient in Quot64
Содержание TMS320C28x
Страница 30: ...1 12...
Страница 80: ...This page intentionally left blank 2 50 This page intentionally left blank...
Страница 269: ...IN loc16 PA 6 112 MOV AL 0 AL 0 UOUT IORegC AL IOspace IORegC AL 10...
Страница 308: ...MAXCUL P loc32 6 151 Saturate MOVL Var64 2 ACC Store result into Var64 MOVL Var64 P...
Страница 509: ...SUBL ACC P PM 6 352 SUBL ACC P PM ACC S B 11 M X 4 MOVH Y ACC 5 Store Q15 result into Y...
Страница 585: ...This page intentionally left blank 7 32 This page intentionally left blank...