Prev: 25715 Up: Map Next: 25758
25733: Play Explosion Sound
Used by the routine at ExplodeBug.
Plays 32 square waves of falling pitch. A random value from RandomNumber is written over the operand of the instruction at 25748, which changes the durations, so this isn't the same twice.
PlayExplosionSound 25733 LD A,(24089) Fetch the random value from RandomNumber.
25736 AND %01111111 Keep only bits 0-6.
25738 OR %00110000 Set bits 4-5.
25740 LD (25749),A Write this over the operand of the instruction at 25748.
25743 LD C,32 Set the wave counter in C to 32.
PlayExplosionSound_Loop 25745 LD A,C Fetch the wave counter.
25746 XOR %00001111 Flip bits 0-3.
25748 AND %00011111 Keep only the bits set in the operand written at 25740.
25750 LD D,A Set the duration of the wave in D.
25751 CALL PlaySquareWave Call PlaySquareWave.
25754 DEC C Decrease the wave counter by one.
25755 JR NZ,PlayExplosionSound_Loop Loop back to PlayExplosionSound_Loop until all of the waves have been played.
25757 RET Return.
Prev: 25715 Up: Map Next: 25758