Prev: B472 Up: Map Next: B4A3
B489: 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 2000 bytes of the ROM.
Pick a random ROM address and play sixteen bursts.
PlayRandomNoise B489 LD A,($5BA5) Fetch the second random seed from RandomSeed2.
B48C LD L,A Use it as the low byte of a ROM address.
B48D LD A,($5BA2) Fetch the frame counter from FrameCounter.
B490 AND %00011111 Keep the lowest five bits.
B492 LD H,A Use it as the high byte of the ROM address.
B493 LD E,$10 Set the number of bursts to play.
PlayRandomNoise_NextBeep B495 LD A,(HL) Fetch the next byte of the ROM.
B496 INC HL Move on to the next one.
B497 AND %01111111 Keep the lowest seven bits.
B499 LD B,A Use it as the pitch.
B49A LD C,$02 Set the number of cycles of each burst.
B49C CALL PlayWaveSequence Play the tone.
B49F DEC E Decrease the burst counter and loop back to PlayRandomNoise_NextBeep until all of the bursts have been played.
B4A0 JR NZ,PlayRandomNoise_NextBeep
B4A2 RET Return.
View the equivalent code in;
Prev: B472 Up: Map Next: B4A3