Line Drawing - Motorola DSP96002 User Manual

32-bit digital signal processor
Table of Contents

Advertisement

B.1.42 Signed Reciprocal Generation
This generates a fast approximation to 1/x.
fseedd
fmpy.s
fsub.s
fmpy.s
fseedd
fmpy.s
fsub.s
fmpy.s
fmpy
fmpy.s
B.1.43 Line Drawing
B.1.43.1 Floating-Point Incremental Line Drawing Algorithm
This algorithm generates points along a line given the endpoints. As the coordinate along one axis is incre-
mented in fixed point, the other coordinate is incremented in floating-point and then converted to fixed
point. A full line drawing algorithm which draws lines in all directions is given below.
Registers:
d0 = temporary
d1 = temporary
d2 = x1 (dx)
d3 = y1 (dy)
B-76
Approximation of 1/d1
16 Bit Accuracy
d1,d6
d1,d6,d1
#2.0,d4.s
d1,d4
d6,d4,d1
Approximation of 1/d1
32 Bit Accuracy
d1,d6
d1,d6,d1
#2.0,d4.s
d1,d4
d4.s,d3.s
d1,d4,d1
d6,d4,d1
fsub.s d1,d3
d1,d3,d1
d4 = temporary x1
d5 = temporary y1
d6 = x0 and xScreen
d7 = y0 and yScreen
DSP96002 USER'S MANUAL
d8 =
d9 = 2.0
Program
ICycles
Words
1
1
2
2
1
1
1
1
---
---
Totals:
5
5
Program
ICycles
Words
1
1
2
2
1
1
1
1
1
1
1
1
---
---
Totals:
7
7
MOTOROLA

Advertisement

Table of Contents
loading

Table of Contents