Prev: 6CAD Up: Map Next: 6CD6
6CB8: Play fast speed engine sound
Generates the engine sound for fast speed. Called when only CONTROLS_BIT_SPEED_CHANGED is set (player holding up). HL points to the controls byte on entry.
  • Period = (controls_byte AND $07), used for speaker ON delay
  • Fixed OFF delay of 4 iterations (shorter than ON = asymmetric wave)
  • Asymmetric wave gives a higher-pitched timbre than normal speed
Input
HL Pointer to state_controls (controls state byte)
beep_engine_fast 6CB8 LD A,(HL) Extract period from low 3 bits of controls byte.
6CB9 AND $07
6CBB LD E,A
6CBC LD C,$08 Loop counter: 8 cycles of the waveform.
beep_engine_fast_loop 6CBE LD A,$10 Speaker ON.
6CC0 OUT ($FE),A
6CC2 LD D,E Load period into D.
beep_engine_fast_delay_on 6CC3 DEC D Delay loop for speaker ON phase.
6CC4 JR NZ,beep_engine_fast_delay_on
6CC6 LD A,$00 Speaker OFF.
6CC8 OUT ($FE),A
6CCA LD D,$04 Load fixed delay ($04) into D.
beep_engine_fast_delay_off 6CCC DEC D Delay loop for speaker OFF phase (asymmetric wave).
6CCD JR NZ,beep_engine_fast_delay_off
6CCF DEC C Decrement cycle counter, loop if not zero. Return from interrupt when done.
6CD0 JP NZ,beep_engine_fast_loop
6CD3 JP int_return
Prev: 6CAD Up: Map Next: 6CD6