Prev: AF5F Up: Map Next: AF76
AF66: Play Square Wave
Used by the routines at PlayStatic, PlayFootstepSound, PlayBuzz and PlayWaveSequence.
Plays one pulse, which is a high and a low half of the same length, by toggling the speaker. B is unchanged.
Input
B The length of the pulse
Turn the speaker on for the length of the pulse.
PlaySquareWave AF66 LD A,$10 Set the speaker bit.
AF68 OUT ($FE),A Turn the speaker on.
AF6A LD A,B Keep the length of the pulse in A.
PlaySquareWave_FirstDelay AF6B DJNZ PlaySquareWave_FirstDelay Wait for the length of the pulse.
AF6D LD B,A Restore the length of the pulse.
Turn the speaker off for the same length.
AF6E XOR A Clear the speaker bit.
AF6F OUT ($FE),A Turn the speaker off.
AF71 LD A,B Keep the length of the pulse in A.
PlaySquareWave_SecondDelay AF72 DJNZ PlaySquareWave_SecondDelay Wait for the length of the pulse.
AF74 LD B,A Restore the length of the pulse.
AF75 RET Return.
Prev: AF5F Up: Map Next: AF76