Prev: 49243 Up: Map Next: 49266
49250: 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 49250 LD A,16 Switch the speaker on.
49252 OUT (254),A
49254 LD A,B Keep the pitch in A.
PlaySquareWave_FirstWait 49255 DJNZ PlaySquareWave_FirstWait Wait for a time that depends on the pitch.
49257 LD B,A Restore the pitch.
49258 XOR A Switch the speaker off.
49259 OUT (254),A
49261 LD A,B Keep the pitch in A.
PlaySquareWave_SecondWait 49262 DJNZ PlaySquareWave_SecondWait Wait for the second half of the beep.
49264 LD B,A Restore the pitch.
49265 RET Return.
View the equivalent code in;
Prev: 49243 Up: Map Next: 49266