beautypg.com

Motorola DSP96002 User Manual

Page 597

background image

B-78

DSP96002 USER’S MANUAL

MOTOROLA

; Switch endpoints if necessary

_inc_x

ftst d2 d3.s,d0.s 1 1

ftfr.s d4,d6 fflt 1 1

ftfr.s d5,d7 fflt 1 1

; Fix x0 and dx

int d6 d2.s,d1.s 1 1

int d1 1 1

neg d1 iflt 1 1

jeq _draw1_x 2 2

; Calculate dy/dx

fseedd d2,d4 1 1

fmpy.s d2,d4,d5 d9.s,d2.s 1 1

fmpy d0,d4,d0 fsub.s d5,d2 d2.s,d3.s 1 1

fmpy.s d5,d2,d5 d2.s,d4.s 1 1

fmpy d0,d4,d0 fsub.s d5,d3 1 1

fmpy.s d0,d3,d0 d7.s,d2.s 1 1

; Draw first point

int d7 1 1

jsr _draw_point application dependent

; d0 = dy/dx d1 = dx d6 = x0 d7 = y0

do d1.l,_end_x 2 3

fadd.x d0,d2 1 1

inc d6 d2.s,d7.s 1 1

int d7 1 1

jsr _draw_point application dependent

_end_x

rts 2 2

_draw1_x

int d7 1 1

jsr _draw_point application dependent

rts 2 2

Performance:

Trivial case: (single point) 16 cycles

Other cases: 25 + 3n cycles