Prev: 50176 Up: Map Next: 50261
50229: Play Random Sound
Used by the routine at UpdateBurst.
Plays sixteen tones with pitches taken from a random place in the ROM, if the object at IX has been drawn in the view (bit 1 of its flags).
Input
IX Object
PlayRandomSound 50229 BIT 1,(IX+7) Return if the object has not been drawn in the view, otherwise clear the flag.
50233 RES 1,(IX+7)
50237 RET Z
50238 LD HL,(48042) Fetch the random number.
50241 LD A,H Turn it into the address of a random place in the first 8192 bytes of the ROM.
50242 AND 31
50244 LD H,A
50245 LD E,16 Set a counter for sixteen tones.
PlayRandomSound_Loop 50247 LD A,(HL) Play a short tone, with a pitch taken from the ROM, and loop back until all sixteen tones have been played.
50248 INC HL
50249 AND 127
50251 LD B,A
50252 LD C,1
50254 CALL PlayTone
50257 DEC E
50258 JR NZ,PlayRandomSound_Loop
50260 RET Return.
Prev: 50176 Up: Map Next: 50261