Prev: 71D3 Up: Map Next: 71F0
71E0: Sound one square-wave cycle: B loops on, B loops off
Used by the routines at rising_sweep, warble, sound_flutter, zap_sweep and sound_buzz.
The building block of the tones and sweeps. One cycle takes about 26 x B T-states, so the pitch falls as B grows. B comes back unchanged, so a caller can loop on it.
Input
B Half the period, in loops (0 = 256)
beep_cycle 71E0 LD A,$10 Speaker on for B loops, keeping B
71E2 OUT ($FE),A
71E4 LD A,B
beep_cycle_0 71E5 DJNZ beep_cycle_0
71E7 LD B,A
71E8 XOR A Speaker off for B loops, B restored
71E9 OUT ($FE),A
71EB LD A,B
beep_cycle_1 71EC DJNZ beep_cycle_1
71EE LD B,A
71EF RET
Prev: 71D3 Up: Map Next: 71F0