Prev: 40689 Up: Map Next: 40746
40710: Play Random Noise
Used by the routine at StartBurst.
Plays a series of pulses of rising length, using the random number generator to set the length of the series and the speed of the rise.
PlayRandomNoise 40710 LD A,(24474) Fetch the low byte of the seed from RandomNumber_Seed.
40713 AND %00011111 Use bits 0-4.
40715 ADD A,7 Add 7 to make the first pulse length.
40717 LD B,A Use it as the length of the pulse.
40718 ADD A,20 Add 20 to make the first gap length.
40720 LD D,A Use it as the length of the gap.
40721 LD A,(24475) Fetch the random number from 24475.
40724 AND %00001111 Use bits 0-3.
40726 ADD A,16 Add 16 to make the number of pulses.
40728 LD C,A Set the number of pulses.
PlayRandomNoise_Pulse 40729 PUSH BC Save the counters.
40730 CALL PlayPulse Play a pulse.
40733 POP BC Restore the counters.
40734 LD A,B Fetch the length of the pulse.
40735 ADD A,8 Add 8.
40737 LD B,A Store it.
40738 LD A,D Fetch the length of the gap.
40739 ADD A,7 Add 7.
40741 LD D,A Store it.
40742 DEC C Decrease the number of pulses by one.
40743 JR NZ,PlayRandomNoise_Pulse Jump back until they have all been played.
40745 RET Return.
Prev: 40689 Up: Map Next: 40746