| Prev: 6BDB | Up: Map | Next: 6C24 |
6BED: Dispatch sound effects from flag state
|
Sound processing dispatcher called from interrupt handler. Reads sound_flags sound flags and dispatches to sound routines. FIRE, BONUS_LIFE, and EXPLODING use <code>CALL NZ</code> — the routine returns and the dispatcher continues to the next check. LOW_FUEL uses <code>JP NZ</code> — execution jumps away and the engine check is never reached. Engine plays only when LOW_FUEL is clear.
|
||||||||||||||||||||||||||||||||||||
|
Flags are set by game logic (input handlers, collision, fuel system) and cleared by sound routines when complete.
Because EXPLODING uses <code>CALL NZ</code> and the engine check follows, explosion mixes with the engine in the same interrupt frame — this happens every time an enemy or the player is destroyed. Fire and explosion cannot mix: spawn_explosion_fragment clears SOUND_BIT_FIRE when setting SOUND_BIT_EXPLODING. LOW_FUEL and engine are mutually exclusive: the <code>JP NZ</code> to do_low_fuel bypasses all engine checks.
|
||||||||||||||||||||||||||||||||||||
| dispatch_sounds | 6BED | LD A,($5C08) | Skip if LAST_K is 'h'. | |||||||||||||||||||||||||||||||||
| 6BF0 | CP $68 | |||||||||||||||||||||||||||||||||||
| 6BF2 | JP Z,int_return | |||||||||||||||||||||||||||||||||||
| 6BF5 | LD HL,$6BB0 | Check FIRE_SOUND → do_fire. | ||||||||||||||||||||||||||||||||||
| 6BF8 | BIT 0,(HL) | |||||||||||||||||||||||||||||||||||
| 6BFA | CALL NZ,do_fire | |||||||||||||||||||||||||||||||||||
| 6BFD | BIT 4,(HL) | Check BONUS_LIFE → do_bonus_life. | ||||||||||||||||||||||||||||||||||
| 6BFF | CALL NZ,do_bonus_life | |||||||||||||||||||||||||||||||||||
| 6C02 | LD HL,$6BB0 | |||||||||||||||||||||||||||||||||||
| 6C05 | BIT 5,(HL) | Check EXPLODING → beep_explosion. | ||||||||||||||||||||||||||||||||||
| 6C07 | CALL NZ,beep_explosion | |||||||||||||||||||||||||||||||||||
| 6C0A | LD HL,$6BB0 | |||||||||||||||||||||||||||||||||||
| 6C0D | BIT 3,(HL) | Check LOW_FUEL → do_low_fuel. | ||||||||||||||||||||||||||||||||||
| 6C0F | JP NZ,do_low_fuel | |||||||||||||||||||||||||||||||||||
| 6C12 | LD A,(HL) | |||||||||||||||||||||||||||||||||||
| 6C13 | AND $06 | Mask speed bits. | ||||||||||||||||||||||||||||||||||
| 6C15 | CP $02 | Normal speed → beep_engine_normal. | ||||||||||||||||||||||||||||||||||
| 6C17 | JP Z,beep_engine_normal | |||||||||||||||||||||||||||||||||||
| 6C1A | CP $04 | Fast speed → beep_engine_fast. | ||||||||||||||||||||||||||||||||||
| 6C1C | JP Z,beep_engine_fast | |||||||||||||||||||||||||||||||||||
| 6C1F | CP $06 | Slow speed → beep_engine_slow. | ||||||||||||||||||||||||||||||||||
| 6C21 | JP Z,beep_engine_slow | |||||||||||||||||||||||||||||||||||
| Prev: 6BDB | Up: Map | Next: 6C24 |