Prev: 50275 Up: Map Next: 50305
50289: 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 50289 LD A,16 Turn the speaker on.
50291 OUT (254),A
50293 LD A,B Keep the pitch in A.
PlaySquareWave_High 50294 DJNZ PlaySquareWave_High Wait, to make the first half of the cycle.
50296 LD B,A Restore the pitch.
50297 XOR A Turn the speaker off.
50298 OUT (254),A
50300 LD A,B Keep the pitch in A.
PlaySquareWave_Low 50301 DJNZ PlaySquareWave_Low Wait, to make the second half of the cycle.
Get the pitch back and return.
50303 LD B,A Restore the pitch.
50304 RET Return.
Prev: 50275 Up: Map Next: 50305