Prev: D67B Up: Map Next: D692
D682: Play Square Wave
Used by the routines at PlayJumpSound, PlayProjectileSound and PlayWaveSequence.
Plays a single beep by switching the speaker on, waiting, switching it off and waiting again. The bigger the pitch, the longer the beep.
Input
B Pitch
Hold the speaker on, then off.
PlaySquareWave D682 LD A,$10 Turn the speaker on.
D684 OUT ($FE),A
D686 LD A,B Keep the pitch in A.
PlaySquareWave_On D687 DJNZ PlaySquareWave_On Wait for the first half of the beep.
D689 LD B,A Restore the pitch.
D68A XOR A Turn the speaker off.
D68B OUT ($FE),A
D68D LD A,B Keep the pitch in A.
PlaySquareWave_Off D68E DJNZ PlaySquareWave_Off Wait for the second half of the beep.
D690 LD B,A Restore the pitch.
D691 RET Return.
Prev: D67B Up: Map Next: D692