Prev: 44895 Up: Map Next: 44918
44902: 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 44902 LD A,16 Set the speaker bit.
44904 OUT (254),A Turn the speaker on.
44906 LD A,B Keep the length of the pulse in A.
PlaySquareWave_FirstDelay 44907 DJNZ PlaySquareWave_FirstDelay Wait for the length of the pulse.
44909 LD B,A Restore the length of the pulse.
Turn the speaker off for the same length.
44910 XOR A Clear the speaker bit.
44911 OUT (254),A Turn the speaker off.
44913 LD A,B Keep the length of the pulse in A.
PlaySquareWave_SecondDelay 44914 DJNZ PlaySquareWave_SecondDelay Wait for the length of the pulse.
44916 LD B,A Restore the length of the pulse.
44917 RET Return.
Prev: 44895 Up: Map Next: 44918