Prev: 49266 Up: Map Next: 49323
49293: Make Noise If Visible
Used by the routines at AnimateSmoke and EndSmoke.
Makes a burst of noise, if the entity is visible. It is made of sixteen short tones with pitches that come from bytes of the ROM picked at random.
Input
IX Entity
MakeNoiseIfVisible 49293 BIT 0,(IX+15) Return if the entity cannot be seen.
49297 RET Z
49298 LD A,R Pick a random page of the ROM...
49300 AND 31
49302 LD H,A
49303 LD A,(38423) ...and a random place in it.
49306 LD L,A
49307 LD E,16 There are sixteen tones.
MakeNoiseIfVisible_Loop 49309 LD A,(HL) Fetch a byte of the ROM, and move on to the next one.
49310 INC HL
49311 AND 127 Keep the lower seven bits of it.
49313 LD B,A Use it as the pitch.
49314 LD C,1 Each tone is made of one cycle.
49316 CALL PlayWaveSequence Make the tone using PlayWaveSequence.
49319 DEC E Loop back until all sixteen tones have been made.
49320 JR NZ,MakeNoiseIfVisible_Loop
49322 RET Return.
Prev: 49266 Up: Map Next: 49323