Prev: B8D4 Up: Map Next: B8E8
B8DA: Play Square Wave
Plays one cycle of a square wave through the speaker, with C setting the length of each half of the cycle.
Input
C Pitch (length of each half of the wave)
PlaySquareWave B8DA LD B,C Copy the pitch into B, then decrease it by one and jump back to Silence_Loop until it is zero.
Silence_Loop B8DB DJNZ Silence_Loop
B8DD LD A,$10 Write 10 to port FE to turn the speaker on (bit 4).
B8DF OUT ($FE),A
B8E1 LD B,C Copy the pitch into B, then decrease it by one and jump back to PlaySquareWave_Loop until it is zero.
PlaySquareWave_Loop B8E2 DJNZ PlaySquareWave_Loop
B8E4 XOR A Write 00 to port FE to turn the speaker off.
B8E5 OUT ($FE),A
B8E7 RET Return.
View the equivalent code in;
Prev: B8D4 Up: Map Next: B8E8