Prev: 46843 Up: Map Next: 46866
46850: 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 46850 LD A,16 Turn the speaker on.
46852 OUT (254),A
46854 LD A,B Keep the pitch in A.
PlaySquareWave_FirstDelay 46855 DJNZ PlaySquareWave_FirstDelay Wait for the first half of the beep.
46857 LD B,A Restore the pitch.
46858 XOR A Turn the speaker off.
46859 OUT (254),A
46861 LD A,B Keep the pitch in A.
PlaySquareWave_SecondDelay 46862 DJNZ PlaySquareWave_SecondDelay Wait for the second half of the beep.
46864 LD B,A Restore the pitch.
46865 RET Return.
View the equivalent code in;
Prev: 46843 Up: Map Next: 46866