Prev: 6CB8 Up: Map Next: 6CF4
6CD6: Play slow speed engine sound
Generates the engine sound for slow speed. Called when both CONTROLS_BIT_SPEED_NOT_FAST and CONTROLS_BIT_SPEED_CHANGED are set (player holding down). HL points to the controls byte on entry.
  • Period = (controls_byte AND $17), uses bits 0-2 and bit 4
  • Fixed OFF delay of $0C (12) iterations (longer than fast speed sound)
  • Lower-pitched timbre than normal and fast speeds
Input
HL Pointer to state_controls (controls state byte)
beep_engine_slow 6CD6 LD A,(HL) Extract period from bits 0-2 and bit 4 of controls byte.
6CD7 AND $17
6CD9 LD E,A
6CDA LD C,$08 Loop counter: 8 cycles of the waveform.
beep_engine_slow_loop 6CDC LD A,$10 Speaker ON.
6CDE OUT ($FE),A
6CE0 LD D,E Load period into D.
beep_engine_slow_delay_on 6CE1 DEC D Delay loop for speaker ON phase.
6CE2 JR NZ,beep_engine_slow_delay_on
6CE4 LD A,$00 Speaker OFF.
6CE6 OUT ($FE),A
6CE8 LD D,$0C Load fixed delay ($0C) into D.
beep_engine_slow_delay_off 6CEA DEC D Delay loop for speaker OFF phase.
6CEB JR NZ,beep_engine_slow_delay_off
6CED DEC C Decrement cycle counter, loop if not zero. Return from interrupt when done.
6CEE JP NZ,beep_engine_slow_loop
6CF1 JP int_return
Prev: 6CB8 Up: Map Next: 6CF4