Prev: 649E Up: Map Next: 64B8
64AA: 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 64AA LD A,$10 Switch the speaker on (bit 4) and write it to the port.
64AC OUT ($FE),A
64AE LD B,D Set the delay counter in B to the duration of the wave.
PlaySquareWave_Loop 64AF 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.
64B1 XOR A Switch the speaker off and write it to the port.
64B2 OUT ($FE),A
64B4 LD B,D Set the delay counter in B to the duration of the wave.
Silence_Loop 64B5 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.
64B7 RET Return.
View the equivalent code in;
Prev: 649E Up: Map Next: 64B8