Prev: 24859 Up: Map Next: 24920
24907: Play Square Wave
Used by the routines at SoundsBounce, SoundsCupRefuel and SoundsEngine.
Plays one cycle of a square wave. The speaker is flipped, then flipped back again after a delay of the same length.
Input
D Delay count for each half of the wave
PlaySquareWave 24907 CALL PlaySound Flip the speaker using PlaySound.
24910 LD B,D Set the delay counter to the period of the wave.
PlaySquareWave_Loop_1 24911 DJNZ PlaySquareWave_Loop_1 Decrease the delay counter by one and loop back to PlaySquareWave_Loop_1 until the first half of the wave is over.
24913 CALL PlaySound Flip the speaker using PlaySound.
24916 LD B,D Set the delay counter to the period of the wave.
PlaySquareWave_Loop_2 24917 DJNZ PlaySquareWave_Loop_2 Decrease the delay counter by one and loop back to PlaySquareWave_Loop_2 until the second half of the wave is over.
24919 RET Return.
View the equivalent code in;
Prev: 24859 Up: Map Next: 24920