Prev: C072 Up: Map Next: C0AB
C08D: 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 C08D BIT 0,(IX+$0F) Return if the entity cannot be seen.
C091 RET Z
C092 LD A,R Pick a random page of the ROM...
C094 AND $1F
C096 LD H,A
C097 LD A,($9617) ...and a random place in it.
C09A LD L,A
C09B LD E,$10 There are sixteen tones.
MakeNoiseIfVisible_Loop C09D LD A,(HL) Fetch a byte of the ROM, and move on to the next one.
C09E INC HL
C09F AND $7F Keep the lower seven bits of it.
C0A1 LD B,A Use it as the pitch.
C0A2 LD C,$01 Each tone is made of one cycle.
C0A4 CALL PlayWaveSequence Make the tone using PlayWaveSequence.
C0A7 DEC E Loop back until all sixteen tones have been made.
C0A8 JR NZ,MakeNoiseIfVisible_Loop
C0AA RET Return.
Prev: C072 Up: Map Next: C0AB