Prev: 8960 Up: Map Next: 8A0F
89D9: "Thud" sound effect
The game uses a delay multiplier of 8 for car landings and 3 for hazard hits.
Input
D Delay multiplier value
sfx_thud 89D9 LD C,$20 Length of table is 32
89DB LD HL,$89EF Point HL at the effect data table
89DE XOR A Zero output byte
sfx_thud_loop 89DF LD B,(HL) Read a byte (a delay)
sfx_thud_output 89E0 OUT ($FE),A Output
89E2 LD E,D Delay/hold for D iterations
sfx_thud_delay 89E3 DEC E
89E4 JR NZ,sfx_thud_delay
This will jump back and re-do the OUT again, but A will not have changed value in the meanwhile... however it might be this way for timing reasons.
89E6 DJNZ sfx_thud_output Loop for B iterations
89E8 XOR $10 Toggle the EAR bit
89EA INC HL Advance to next effect data byte
89EB DEC C Loop until out of effect data
89EC JR NZ,sfx_thud_loop
89EE RET Return
sfx_thud_table 89EF DEFB $02,$07,$05,$02,$04,$0A,$01,$04 Each byte is a delay between speaker toggles (off-on-off-...)
89F7 DEFB $09,$09,$06,$45,$01,$01,$04,$03
89FF DEFB $01,$03,$31,$04,$25,$02,$01,$BD
8A07 DEFB $8E,$ED,$01,$01,$01,$06,$07,$01
Prev: 8960 Up: Map Next: 8A0F