| Chase H.Q. | Routines |
| Prev: DAE9 | Up: Map | Next: E06C |
|
Runs the end-of-game results screen: clears the playfield, starts the beatbox and this bank's own interrupt-driven music and script engine, then loops driving the script, the current frame-advance handler and drive_chatter until the fire key has been pressed twice -- once to skip ahead to the congratulations script, once more to leave.
The whole bank has already been paged in and copied down to $5C00..$7BFF, so every address here reads $8400 lower at run time ($E000 runs at $5C00). This routine then performs a second, inner relocation of its own: the 768 bytes at $F7EF (bank7_reset_music onwards) are copied to $F300, which is why the calls below target $F300 and $F340 rather than the bank addresses the code was assembled at.
The five bytes at $A16D..$A171 are the engine's state: the script pointer ($A16D/$A16E), the input mask ($A16F), the script frame countdown ($A170) and the keyscan divider ($A171).
|
||||
| show_end_screen | E000 | CALL $6099 | Call es_clear | |
| E003 | LD HL,$73EF | Source $F7EF, the reset_music/play_music_48k block | ||
| E006 | LD DE,$F300 | Destination of the inner relocation | ||
| E009 | LD BC,$02FF | 768 bytes | ||
| E00C | LDIR | Copy | ||
|
$A16D = $5CFE [$E0FE here]
|
||||
| E00E | LD HL,$A16D | $A16D -> script_data [$5CFE] | ||
| E011 | LD (HL),$FE | |||
| E013 | INC HL | |||
| E014 | LD (HL),$5C | |||
| E016 | INC HL | |||
| E017 | LD (HL),C | $A16F C is zero | ||
| E018 | INC HL | |||
| E019 | LD (HL),$01 | $A170 | ||
| E01B | INC HL | |||
| E01C | LD (HL),$06 | $A171 | ||
| E01E | CALL $73D1 | Call bank7_setup_interrupts | ||
| E021 | CALL $F300 | Call reset_music (relocated copy of bank7_reset_music, bank7_reset_music, copied here by the LDIR above) | ||
| E024 | EI | Enable interrupts | ||
| E025 | HALT | Wait for an interrupt | ||
| es_loop | E026 | CALL $F340 | Call play_music_48k (relocated copy of b7_play_music_48k, b7_play_music_48k) | |
| E029 | LD HL,$A170 | Decrement $A170 | ||
| E02C | DEC (HL) | |||
| E02D | CALL Z,$5E0A | Call run_script | ||
| E030 | CALL $5ED8 | Call <self modified> | ||
| E033 | LD HL,$A171 | Decrement $A171 | ||
| E036 | DEC (HL) | |||
| E037 | JR NZ,es_loop | Loop while > 0 | ||
| E039 | LD (HL),$05 | Reset $A171 to 5 | ||
| E03B | CALL $9965 | Call drive_chatter | ||
| E03E | CALL $A0D6 | Call keyscan | ||
| E041 | AND $10 | Loop while key not pressed | ||
| E043 | JR Z,es_loop | |||
| E045 | LD A,($A16F) | AND user input with user input mask | ||
| E048 | AND A | |||
| E049 | JR NZ,show_end_screen_1 | Jump if masked key remains pressed | ||
| E04B | INC A | A is zero here, so this sets it to 1 | ||
| E04C | LD ($A16F),A | Mark the first fire press as consumed | ||
| E04F | LD ($A170),A | Run the script on the next frame | ||
| E052 | LD HL,$5DE3 | Set script data pointer to $5DE3 [$E1E3] | ||
| E055 | LD ($A16D),HL | |||
| E058 | CALL $99D3 | Call drive_chatter_stop | ||
| show_end_screen_0 | E05B | CALL $A0D6 | Call keyscan | |
| E05E | AND $10 | Loop while key pressed | ||
| E060 | JR NZ,show_end_screen_0 | |||
| E062 | JR es_loop | Loop | ||
| show_end_screen_1 | E064 | DI | ||
| E065 | LD A,$80 | Set interrupt vector table base to $8000 | ||
| E067 | LD I,A | |||
| E069 | JP $99D3 | Call drive_chatter_stop | ||
| Prev: DAE9 | Up: Map | Next: E06C |