Prev: 88F2 Up: Map Next: 8960
8903: Drives sound effects
Used by the routine at main_loop.
drive_sfx 8903 LD A,($A23B) Jump if tunnel_sfx
8906 AND A
8907 JR NZ,drive_sfx_0
8909 LD A,($A23C) var_a23d |= var_a23c
890C LD HL,$A23D
890F OR (HL)
8910 LD BC,$0704 Counters?
8913 CALL NZ,start_sfx Call start_sfx if non-zero
drive_sfx_0 8916 CALL engine_sfx_setup_hook Call engine_sfx_setup_hook
8919 CALL engine_sfx_play_hook Call engine_sfx_play_hook
891C CALL write_registers_hook Call write_registers_hook
891F LD A,($A237) If sfx_0 == 0 return
8922 AND A
8923 RET Z
8924 RLCA E = sfx_0 * 4 -- stride of table
8925 RLCA
8926 LD E,A
8927 XOR A sfx_0 = 0
8928 LD ($A237),A
892B LD ($A238),A sfx_1 = 0
892E LD D,A Make DE full offset
892F LD HL,$8938 HL -> Base of table, but 4 bytes earlier
8932 ADD HL,DE Point at array element
8933 LD D,(HL) Load argument value into DE (note: big endian!)
8934 INC HL
8935 LD E,(HL)
8936 INC HL
8937 LD A,(HL) Load address of routine into HL
8938 INC HL
8939 LD H,(HL)
893A LD L,A
893B JP (HL) Exit via routine at HL
Pairs of words: (argument [big endian], address of sound effect routine)
sfx_table 893C DEFW $0164 Argument in DE for sound effect routine
893E DEFW sfx_cornering Sound effect routine sfx_cornering
8940 DEFW $0008 Argument in DE for sound effect routine: D = delay of 8
8942 DEFW sfx_thud Sound effect routine sfx_thud
8944 DEFW $0008 Argument in DE for sound effect routine
8946 DEFW sfx_crash Sound effect routine sfx_crash - crash
8948 DEFW $000C Argument in DE for sound effect routine (low)
894A DEFW sfx_crash Sound effect routine sfx_crash - crash
894C DEFW $0003 Argument in DE for sound effect routine
894E DEFW sfx_thud Sound effect routine sfx_thud
8950 DEFW $041A Argument in DE for sound effect routine
8952 DEFW sfx_cornering_loop_outer Sound effect routine sfx_cornering_loop_outer
8954 DEFW $7804 Argument in DE for sound effect routine - "tit-tit" used when cornering
8956 DEFW sfx_cornering_loop_outer Sound effect routine sfx_cornering_loop_outer
8958 DEFW $7878 Argument in DE for sound effect routine - time running out high "bip"
895A DEFW sfx_bipbow Sound effect routine sfx_bipbow - "bip-bow"
895C DEFW $C8C8 Argument in DE for sound effect routine - time running out low "bow"
895E DEFW sfx_bipbow Sound effect routine sfx_bipbow - "bip-bow"
Prev: 88F2 Up: Map Next: 8960