Prev: B6FB Up: Map Next: B712
B702: Play Square Wave
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 B702 LD A,$10 Turn the speaker on.
B704 OUT ($FE),A
B706 LD A,B Keep the pitch in A.
PlaySquareWave_FirstDelay B707 DJNZ PlaySquareWave_FirstDelay Wait for the first half of the beep.
B709 LD B,A Restore the pitch.
B70A XOR A Turn the speaker off.
B70B OUT ($FE),A
B70D LD A,B Keep the pitch in A.
PlaySquareWave_SecondDelay B70E DJNZ PlaySquareWave_SecondDelay Wait for the second half of the beep.
B710 LD B,A Restore the pitch.
B711 RET Return.
View the equivalent code in;
Prev: B6FB Up: Map Next: B712