Prev: D635 Up: Map Next: D665
D64E: 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 D64E LD HL,($A70D) Fetch the random seed.
D651 LD A,H Fetch the high byte.
D652 AND %00011111 Keep it within the first 2000 bytes of the ROM.
D654 LD H,A Put it in H.
D655 LD E,$04 Set the number of tones to four.
Play four cycles from those bytes.
PlayExplosionSound_Loop D657 LD A,(HL) Fetch a byte of the ROM.
D658 INC HL Move on to the next.
D659 AND %01111111 Make it the pitch, up to 7F.
D65B LD B,A Put the pitch in B.
D65C LD C,$01 Set the length of the tone to one cycle.
D65E CALL PlayWaveSequence Call PlayWaveSequence to make the tone.
D661 DEC E Count the tone.
D662 JR NZ,PlayExplosionSound_Loop Jump to PlayExplosionSound_Loop until all of the tones have been made.
D664 RET Return.
Prev: D635 Up: Map Next: D665