Fork me on GitHub
Prev: 89FA Up: Map Next: 8A1B
8A02: Generate firing sound effect.
Produces the "pew" sound when the player fires a missile by toggling the speaker port rapidly.
do_fire 8A02 LD C,$08 Loop 8 pulses for sound duration.
do_fire_pulse_loop 8A04 LD A,$10 Speaker ON, 32-iteration delay loop (~150 µs ON phase).
8A06 OUT ($FE),A
8A08 LD D,$20
do_fire_delay_loop 8A0A DEC D
8A0B JR NZ,do_fire_delay_loop
8A0D LD A,$00 Speaker OFF. No delay loop: two LD D,$20 are timing filler (7T each); $FD prefix before DEC C adds 4T. OFF phase = 50T (~14 µs), giving a 91% duty cycle waveform.
8A0F OUT ($FE),A
8A11 LD D,$20
8A13 LD D,$20
8A15 DEFB $FD
8A16 DEC C
8A17 JP NZ,do_fire_pulse_loop
8A1A RET
Prev: 89FA Up: Map Next: 8A1B