Prev: 25758 Up: Map Next: 25784
25770: Play Square Wave
Plays one square wave: the speaker is switched on for the duration, then off for the same duration.
Input
D Duration of wave
PlaySquareWave 25770 LD A,16 Switch the speaker on (bit 4) and write it to the port.
25772 OUT (254),A
25774 LD B,D Set the delay counter in B to the duration of the wave.
PlaySquareWave_Loop 25775 DJNZ PlaySquareWave_Loop Decrease the delay counter by one and loop back to PlaySquareWave_Loop until the speaker has been on for the whole duration.
25777 XOR A Switch the speaker off and write it to the port.
25778 OUT (254),A
25780 LD B,D Set the delay counter in B to the duration of the wave.
Silence_Loop 25781 DJNZ Silence_Loop Decrease the delay counter by one and loop back to Silence_Loop until the speaker has been off for the whole duration.
25783 RET Return.
View the equivalent code in;
Prev: 25758 Up: Map Next: 25784