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,drs_8916
8909 LD A,($A23C) var_a23d |= var_a23c
890C LD HL,$A23D
890F OR (HL)
8910 LD BC,$0704 Effect 7 (tit-tit), Priority 4
8913 CALL NZ,start_sfx Call start_sfx if non-zero
drs_8916 8916 CALL play_engine_sfx_hook Call play_engine_sfx_hook
8919 CALL play_engine_or_siren_sfx_hook Call play_engine_or_siren_sfx_hook -- plays engine in 48K, siren in 128K
891C CALL write_registers_hook Call write_registers_hook -- nop in 48K
891F LD A,($A237) If sfx_index == 0 return
8922 AND A
8923 RET Z
8924 RLCA E = sfx_index * 4 -- stride of table
8925 RLCA
8926 LD E,A
8927 XOR A sfx_index = 0
8928 LD ($A237),A
892B LD ($A238),A sfx_priority = 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) The first word is the argument passed in DE to sound effect routine. The second word is the address of the routine.
Effect 1 - Cornering squeal
sfx_table 893C DEFW $0164
893E DEFW sfx_cornering
Effect 2 - Car landing (low thump)
8940 DEFW $0008
8942 DEFW sfx_thud
Effect 3 - Crash (high) - Used for hits on cars
8944 DEFW $0008
8946 DEFW sfx_crash
Effect 4 - Crash (low) - Used for hits on scenery
8948 DEFW $000C
894A DEFW sfx_crash
Effect 5 - Hazard hit (high thump)
894C DEFW $0003
894E DEFW sfx_thud
Effect 6 - Tunnel wall hit
8950 DEFW $041A
8952 DEFW sfx_cornering_loop_outer
Effect 7 - Cornering ("tit-tit")
8954 DEFW $7804
8956 DEFW sfx_cornering_loop_outer
Effect 8 - Time running out high ("bip")
8958 DEFW $7878
895A DEFW sfx_bipbow
Effect 9 - Time running out low ("bow")
895C DEFW $C8C8
895E DEFW sfx_bipbow
Prev: 88F2 Up: Map Next: 8960