EasyManua.ls Logo

Texas Instruments TMS320C28x - Page 506

Texas Instruments TMS320C28x
695 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
SUBCUL ACC,loc32
6-349
Example 4
; Calculate signed: Quot64 = Num364Den32, Rem32 = Num64%Den32
MOVL ACC,@Num64+2 ; Load ACC:P with 64-bit numerator
MOVL P,@Num64+0
TBIT @AH,#15 ; TC = sign of numerator
SBF $10,NTC ; Take absolute value of numerator
NEG64 ACC:P
$10:
MOVL @XAR3,P ; Temp save numerator low in XAR3
MOVL P,@ACC ; Load P register with numerator high
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
MOVB ACC,#0 ; Zero ACC
RPT #31 ; Repeat operation 32 times
||SUBCUL ACC,@XT ; Conditional subtract with denominator
MOVL @XAR4,P ; Store high quotient in XAR4
MOVL P,@XAR3 ; Load P with low numerator
RPT #31 ; Repeat operation 32 times
||SUBCUL ACC,@XT ; Conditional subtract with denominator
MOVL @Rem32,ACC ; Store remainder in Rem32
MOVL ACC,@XAR4 ; Load ACC with high quotient from XAR4
SBF $20,NTC ; Take absolute value of quotient
NEG64 ACC:P
$20:
MOVL @Quot64+0,P ; Store low quotient into Quot64
MOVL @Quot64+2,ACC ; Store high quotient into Quot64

Table of Contents

Related product manuals