Typewriter User Manual

MOTOROLA MC68340 USER’S MANUAL 5- 35
First, the results of each TBL are rounded with the TBLS round-to-nearest-even algorithm.
The following values would be returned by TBLS:
TBL # 1 0010 0000 .
TBL # 2 0011 1111 .
TBL # 3 0000 0001 .
Summing, the following result is obtained:
0010 0000 .
0011 1111 .
0000 0001 .
0110 0000 .
Now, using the same TBL results, the sum is first calculated and then rounded according
to the same algorithm:
0010 0000 . 0111 0000
0011 1111 . 0111 0000
0000 0001 . 0111 0000
0110 0001 . 0101 0000
Rounding yields:
0110 0001 .
The second result is preferred. The following code sequence illustrates how addition of a
series of table interpolations can be performed without loss of precision in the intermediate
results:
L0:
TBLSN.B ea〉, Dx
TBLSN.B ea〉, Dx
TBLSN.B ea〉, Dl
ADD.L Dx, Dm Long addition avoids problems with carry
ADD.L Dm, Dl
ASR.L #8, Dl Move radix point
BCC.B L1 Fraction MSB in carry
ADDQ.B #1, Dl
L1: . . .
Frees
cale Semiconductor,
I
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
nc...