Prev: B4E6 Up: Map Next: B4FD
B4ED: 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 of the tone (smaller values are higher)
Hold the speaker on, then off.
PlaySquareWave B4ED LD A,$10 Set the speaker output high.
B4EF OUT ($FE),A
B4F1 LD A,B Keep the pitch in A.
PlaySquareWave_FirstDelay B4F2 DJNZ PlaySquareWave_FirstDelay Wait for the high part of the cycle.
B4F4 LD B,A Restore the pitch.
B4F5 XOR A Set the speaker output low.
B4F6 OUT ($FE),A
B4F8 LD A,B Keep the pitch in A.
PlaySquareWave_SecondDelay B4F9 DJNZ PlaySquareWave_SecondDelay Wait for the low part of the cycle.
B4FB LD B,A Restore the pitch.
B4FC RET Return.
View the equivalent code in;
Prev: B4E6 Up: Map Next: B4FD