Prev: B65F Up: Map Next: B690
B676: Play Random Noise
Used by the routines at HandleAttackingTool and PlayLandingSoundOnce.
Plays a burst of noise, using 10 bytes of the ROM as the pitches of beeps. The ROM address is taken from RandomSeed2 and FrameCounter.
Point at a random stretch of the ROM.
PlayRandomNoise B676 LD A,($5B05) Fetch RandomSeed2.
B679 LD L,A Use it as the low byte of a ROM address.
B67A LD A,($5B02) Fetch FrameCounter.
B67D AND %00011111 Keep only bits 0 to 4.
B67F LD H,A Use them as the high byte of the address.
B680 LD E,$10 Set a counter of 10 beeps.
Play a beep from each ROM byte.
PlayRandomNoise_NextBeep B682 LD A,(HL) Fetch a byte of the ROM.
B683 INC HL Move on.
B684 AND %01111111 Keep only bits 0 to 6.
B686 LD B,A Keep the pitch in B.
B687 LD C,$02 Set the number of beeps to 02.
B689 CALL PlayWaveSequence Call PlayWaveSequence.
B68C DEC E Count down the beeps.
B68D JR NZ,PlayRandomNoise_NextBeep Jump to PlayRandomNoise_NextBeep until all of them have been played.
B68F RET Return.
View the equivalent code in;
Prev: B65F Up: Map Next: B690