Prev: C463 Up: Map Next: C481
C471: Play Square Wave
Used by the routines at PlayBumpSound, PlaySweepSound and PlayMaterialiseSound.
Plays a single beep by switching the speaker on, waiting, switching it off and waiting again. The bigger the pitch, the longer the beep.
Input
B Pitch
Hold the speaker on, then off.
PlaySquareWave C471 LD A,$10 Turn the speaker on.
C473 OUT ($FE),A
C475 LD A,B Keep the pitch in A.
PlaySquareWave_High C476 DJNZ PlaySquareWave_High Wait, to make the first half of the cycle.
C478 LD B,A Restore the pitch.
C479 XOR A Turn the speaker off.
C47A OUT ($FE),A
C47C LD A,B Keep the pitch in A.
PlaySquareWave_Low C47D DJNZ PlaySquareWave_Low Wait, to make the second half of the cycle.
Get the pitch back and return.
C47F LD B,A Restore the pitch.
C480 RET Return.
Prev: C463 Up: Map Next: C481