Prev: D67B Up: Map Next: D692
D682: One wave
Used by the routines at JUMP_SOUND, FIRE_SOUND and BEEP.
Speaker bit on for B turns of a 13 T-state loop, then off for as long, with the border black throughout. A wave takes 26 times B plus a caller's overhead: 82 T-states within a BEEP, 101 for the jump, 94 for the bolt firing and 151 for the puff (measured): a count of 128 comes out at about 1kHz. The same routine as Knight Lore's.
Input
B the half-wave count, kept
CLICK D682 LD A,$10 speaker on; wait
D684 OUT ($FE),A
D686 LD A,B
CLICK_0 D687 DJNZ CLICK_0
D689 LD B,A
D68A XOR A speaker off; wait; B back
D68B OUT ($FE),A
D68D LD A,B
CLICK_1 D68E DJNZ CLICK_1
D690 LD B,A
D691 RET
Prev: D67B Up: Map Next: D692