beautypg.com

Motorola DSP96002 User Manual

Page 610

background image

MOTOROLA

DSP96002 USER’S MANUAL

B-91

; Determine if point is within view volume

fneg.s d1 d1.s,d2.s ; 1 1

ori #$80,ccr ; 1 1

fcmp d1,d0 d2.s,y:(r1) ; Wn 1 1

fcmp d0,d2 x:(r1)-,d5.s ;Yn 1 1

fcmp d1,d5 n0,d4.s ; 1 1

fcmp d5,d2 y:(r1)-,d6.s ; Zn 1 1

fcmp d4,d6 d7.l,x:(r6) ; 1 1

fcmp d6,d2 d6.s,d7.s ; 1 1

jclr #7,sr,_accept_clip ; 2 3

; Calculate reciprocal 1/W

fseedd d2,d6 ; 1 1

fmpy.s d2,d6,d1 d9.s,d4.s ; 1 1

fsub.s d1,d4 d4.s,d3.s d2.s,y:(r1)- ; Wo 1 1

fmpy.s d1,d4,d1 d0.s,x:(r1)+ d7.s,y: ;Xo Zo 1 1

fmpy d6,d4,d1 fsub.s d1,d3 d5.s,x:(r1)+ ;Yo 1 1

fmpy.s d1,d3,d1 x:(r4)+,d4.s y:,d3.s ;Xs Xf 1 1

; Multiply coordinates by 1/W, scale and add offset

fmpy.s d0,d4,d2 ; 1 1

fmpy.s d2,d1,d2 x:(r4)+,d4.s y:,d6.s ;Ys Yf 1 1

fmpy d5,d4,d3 fadd.s d3,d2 x:(r6),d7.l ; 1 1

fmpy.s d3,d1,d3 d2.s,y:(r5)+ ; 1 1

fadd.s d6,d3 x:(r0)+,d0.s ; 1 1

dec d7 d3.s,y:(r5)+ ; Y1 1 1

jne _accept_loop ; 2 2

jmp _end ; 2 2