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, delay 32 iterations (~150us half-period, ~3.3kHz).
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, same delay. $FD prefix byte adds 4 T-states before DEC C (IY prefix on non-HL instruction = extra delay cycle).
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