Prev: 81DD Up: Map Next: 8258
8204: Generates engine noise (48K)
Used by the routine at start_siren_hook.
setup_engine_sfx_48k 8204 LD HL,($A24A) Load speed into HL
8207 RR H Bottom bit of H moves to carry (H now unused)
This entry point is used by the routine at page_in_stage_128k.
setup_engine_sfx_48k_0 8209 LD A,L Speed low byte
820A RRA Halve speed, shifting carry in as MSB
820B CPL A = ~A
820C SRL A Divide by four
820E SRL A
8210 OR $01 A |= 1
8212 LD L,A HL = 0x0300 | A
8213 LD H,$03
8215 LD A,($A253) Jump if in high gear
8218 AND A
8219 JR NZ,setup_engine_sfx_48k_1
821B SRL L L >>= 1
setup_engine_sfx_48k_1 821D LD A,($A23B) Jump if tunnel_sfx == 0
8220 AND A
8221 JR Z,setup_engine_sfx_48k_2
8223 LD H,$01 H = 1
setup_engine_sfx_48k_2 8225 LD A,L Self modify iterations -- L
8226 LD ($8244),A
8229 LD A,H Self modify delay loop -- H
822A LD ($8249),A
822D NEG Self modify delay loop -- (5 - A)
822F ADD A,$05
8231 LD ($8251),A
This entry point is used by the routine at start_siren_hook.
play_engine_sfx 8234 LD A,($A230) Return if perp_caught_phase is >= 3 (when car stops)
8237 CP $03
8239 RET NC
823A LD A,$00 Self modifying counter produces 0,1,2
823C INC A
823D AND $03
823F LD ($823B),A
8242 RET NZ Return if nonzero
This produces the engine sound effect.
8243 LD C,$03 <Self modified> iterations
setup_engine_sfx_48k_3 8245 XOR A Output 0
8246 OUT ($FE),A
8248 LD B,$00 Delay for B cycles (self modified above)
setup_engine_sfx_48k_4 824A DJNZ setup_engine_sfx_48k_4
824C LD A,$18 Output EAR + MIC
824E OUT ($FE),A
8250 LD B,$00 Delay for B cycles (self modified above)
setup_engine_sfx_48k_5 8252 DJNZ setup_engine_sfx_48k_5
8254 DEC C Loop until iterations is zero
8255 JR NZ,setup_engine_sfx_48k_3
8257 RET Return
Prev: 81DD Up: Map Next: 8258