Prev: 81DD Up: Map Next: 8258
8204: Generates engine noise
Used by the routine at start_siren_hook.
engine_sfx_setup 8204 LD HL,($A24A) Get speed value
8207 RR H A = speed / 2 (top half)
This entry point is used by the routine at page_in_stage_128k.
engine_sfx_setup_0 8209 LD A,L A = speed / 2 (bottom half)
820A RRA
820B CPL A = ~A
820C SRL A A /= 4
820E SRL A
8210 OR $01 A |= 1
8212 LD L,A L = A
8213 LD H,$03 H = 3
8215 LD A,($A253) Jump if in high gear
8218 AND A
8219 JR NZ,engine_sfx_setup_1
821B SRL L L >>= 1
engine_sfx_setup_1 821D LD A,($A23B) Jump if tunnel_sfx == 0
8220 AND A
8221 JR Z,engine_sfx_setup_2
8223 LD H,$01 H = 1
engine_sfx_setup_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.
engine_sfx_play 8234 LD A,($A230) Return if perp_caught_stage 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
engine_sfx_setup_3 8245 XOR A Output 0
8246 OUT ($FE),A
8248 LD B,$00 Delay for B cycles (self modified above)
engine_sfx_setup_4 824A DJNZ engine_sfx_setup_4
824C LD A,$18 Output EAR + MIC
824E OUT ($FE),A
8250 LD B,$00 Delay for B cycles (self modified above)
engine_sfx_setup_5 8252 DJNZ engine_sfx_setup_5
8254 DEC C Loop until iterations is zero
8255 JR NZ,engine_sfx_setup_3
8257 RET Return
Prev: 81DD Up: Map Next: 8258