Example 4
; Calculate signed: Quot64 = Num364Den32, Rem32 = Num64%Den32
MOVL
MOVL
TBIT
SBF
NEG64
$10:
MOVL
MOVL
MOVL
ABSTC
MOVL
MOVB
RPT
||SUBCUL
MOVL
MOVL
RPT
||SUBCUL
MOVL
MOVL
SBF
NEG64
$20:
MOVL
MOVL
ACC,@Num64+2
; Load ACC:P with 64-bit numerator
P,@Num64+0
@AH,#15
; TC = sign of numerator
$10,NTC
; Take absolute value of numerator
ACC:P
@XAR3,P
; Temp save numerator low in XAR3
P,@ACC
; Load P register with numerator high
ACC,@Den32
; Load ACC with contents of Den32
ACC
; Take absolute value, TC = sign ^ TC
XT,@ACC
; Temp save denominator in XT register
ACC,#0
; Zero ACC
#31
; Repeat operation 32 times
ACC,@XT
; Conditional subtract with denominator
@XAR4,P
; Store high quotient in XAR4
P,@XAR3
; Load P with low numerator
#31
; Repeat operation 32 times
ACC,@XT
; Conditional subtract with denominator
@Rem32,ACC
; Store remainder in Rem32
ACC,@XAR4
; Load ACC with high quotient from XAR4
$20,NTC
; Take absolute value of quotient
ACC:P
@Quot64+0,P
; Store low quotient into Quot64
@Quot64+2,ACC
; Store high quotient into Quot64
SUBCUL ACC,loc32
6-349
Need help?
Do you have a question about the TMS320C28x and is the answer not in the manual?