Prev: C05B Up: Map Next: C072
C062: Play Square Wave
Used by the routines at PlayNoiseSound 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. The border is set to black.
Input
B Pitch
Hold the speaker on, then off.
PlaySquareWave C062 LD A,$10 Switch the speaker on.
C064 OUT ($FE),A
C066 LD A,B Keep the pitch in A.
PlaySquareWave_FirstWait C067 DJNZ PlaySquareWave_FirstWait Wait for a time that depends on the pitch.
C069 LD B,A Restore the pitch.
C06A XOR A Switch the speaker off.
C06B OUT ($FE),A
C06D LD A,B Keep the pitch in A.
PlaySquareWave_SecondWait C06E DJNZ PlaySquareWave_SecondWait Wait for the second half of the beep.
C070 LD B,A Restore the pitch.
C071 RET Return.
View the equivalent code in;
Prev: C05B Up: Map Next: C072