Prev: 9EF1 Up: Map Next: 9F2A
9F06: 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 9F06 LD A,($5F9A) Fetch the low byte of the seed from RandomNumber_Seed.
9F09 AND %00011111 Use bits 0-4.
9F0B ADD A,$07 Add 07 to make the first pulse length.
9F0D LD B,A Use it as the length of the pulse.
9F0E ADD A,$14 Add 14 to make the first gap length.
9F10 LD D,A Use it as the length of the gap.
9F11 LD A,($5F9B) Fetch the random number from 5F9B.
9F14 AND %00001111 Use bits 0-3.
9F16 ADD A,$10 Add 10 to make the number of pulses.
9F18 LD C,A Set the number of pulses.
PlayRandomNoise_Pulse 9F19 PUSH BC Save the counters.
9F1A CALL PlayPulse Play a pulse.
9F1D POP BC Restore the counters.
9F1E LD A,B Fetch the length of the pulse.
9F1F ADD A,$08 Add 08.
9F21 LD B,A Store it.
9F22 LD A,D Fetch the length of the gap.
9F23 ADD A,$07 Add 07.
9F25 LD D,A Store it.
9F26 DEC C Decrease the number of pulses by one.
9F27 JR NZ,PlayRandomNoise_Pulse Jump back until they have all been played.
9F29 RET Return.
Prev: 9EF1 Up: Map Next: 9F2A