Prev: 46194 Up: Map Next: 46243
46217: Play Random Noise
Used by the routine at HandleMovingPortcullis.
Plays sixteen short bursts of a tone for the portcullis coming to rest. The pitches come from a random place in the first 8192 bytes of the ROM.
Pick a random ROM address and play sixteen bursts.
PlayRandomNoise 46217 LD A,(23461) Fetch the second random seed from RandomSeed2.
46220 LD L,A Use it as the low byte of a ROM address.
46221 LD A,(23458) Fetch the frame counter from FrameCounter.
46224 AND %00011111 Keep the lowest five bits.
46226 LD H,A Use it as the high byte of the ROM address.
46227 LD E,16 Set the number of bursts to play.
PlayRandomNoise_NextBeep 46229 LD A,(HL) Fetch the next byte of the ROM.
46230 INC HL Move on to the next one.
46231 AND %01111111 Keep the lowest seven bits.
46233 LD B,A Use it as the pitch.
46234 LD C,2 Set the number of cycles of each burst.
46236 CALL PlayWaveSequence Play the tone.
46239 DEC E Decrease the burst counter and loop back to PlayRandomNoise_NextBeep until all of the bursts have been played.
46240 JR NZ,PlayRandomNoise_NextBeep
46242 RET Return.
View the equivalent code in;
Prev: 46194 Up: Map Next: 46243