Prev: 54837 Up: Map Next: 54885
54862: Play Explosion Sound
Used by the routine at RunExplosion.
Makes the noise of an explosion, from four single cycles of tones with pitches that are taken from the ROM, at an address that comes from the random seed.
Point at four ROM bytes from the random seed.
PlayExplosionSound 54862 LD HL,(42765) Fetch the random seed.
54865 LD A,H Fetch the high byte.
54866 AND %00011111 Keep it within the first 8192 bytes of the ROM.
54868 LD H,A Put it in H.
54869 LD E,4 Set the number of tones to four.
Play four cycles from those bytes.
PlayExplosionSound_Loop 54871 LD A,(HL) Fetch a byte of the ROM.
54872 INC HL Move on to the next.
54873 AND %01111111 Make it the pitch, up to 127.
54875 LD B,A Put the pitch in B.
54876 LD C,1 Set the length of the tone to one cycle.
54878 CALL PlayWaveSequence Call PlayWaveSequence to make the tone.
54881 DEC E Count the tone.
54882 JR NZ,PlayExplosionSound_Loop Jump to PlayExplosionSound_Loop until all of the tones have been made.
54884 RET Return.
Prev: 54837 Up: Map Next: 54885