Motorola DSP96002 User Manual
Page 587
B-68
DSP96002 USER’S MANUAL
MOTOROLA
3-D Graphics Illumination
Program
ICycles
Words
move #vec,r0 2 2
move #ktbl,r4 2 2
move x:(r0)+,d6.s y:,d7.s 1 1
fmpy.s d6,d7,d0 x:(r0)+,d6.s y:,d7.s 1 1
fmpy.s d6,d7,d1 x:(r0)+,d6.s y:,d7.s 1 1
fmpy d6,d7,d1 fadd.s d1,d0 x:(r0)+,d6.s y:,d7.s 1 1
fmpy d6,d7,d1 fadd.s d1,d0 x:(r4)+,d2.s 1 1
fmpy.s d2,d0,d0 x:(r4)+,n1 1 1
intrz d0 x:(r0)+,d6.s y:,d7.s 1 1
fmpy.s d6,d7,d0 d0.l,r1 1 1
move x:(r0)+,d6.s y:,d7.s 1 1
fmpy d6,d7,d0 fadd.s d0,d1 x:(r1+n1),d2.s 1 2
fadd.s d0,d1 x:(r4)+,d0.s 1 1
fmpy.s d0,d1,d1 x:(r4)+,d0.s 1 1
fadd.s d1,d2 x:(r4)+,d1.s 1 1
fmpy.s d2,d0 x:(r4),d2.s 1 1
fmpy.s d1,d2,d1 1 1
fadd.s d1,d0 1 1
--- ---
Totals: 20 21
The illumination value I is in d0.
Reference: "Fundamentals of Interactive Computer Graphics",
James D. Foley, Andries Van Dam
Addison-Wesley 1982
B.1.36
Pseudorandom Number Generation
This pseudorandom number generator requires a 32 bit seed and returns an unsigned 32 bit random num-
ber. There are no restrictions on the value of the seed. The equation for the seed is:
seed = (69069*seed + 1) mod 2**32
Pseudorandom Number Generation
Program
ICycles
Words
move x:seed,d0.l ;get seed 2 2
move #69069,d1.l ;get constant 2 2
mpyu d0,d1,d0 ;multiply 1 1
inc d0 ; +1 1 1
move d0.l,x:seed ;mod 2**32, new seed 2 2
--- ---
Totals: 8 8