![]() |
Routines |
| Prev: D356 | Up: Map | Next: D3E4 |
|
Used by the routine at PlayerDeath_TapeLoadContinue.
Handles a lost life and game-over flow: optional HUD and "PLAYER" messaging, decrementing Lives, calling D24C to re-stage the wave, swapping players with SwapPlayerState, printing "GAME OVER" when no lives remain, and either returning to the attract mode at GameEntryPoint or looping. A lookup table at D3E4 (read from D400) supplies a start pointer stored at WaveStartPointer; ECFB jumps to PlayerDeath_TapeLoadContinue after a successful tape load. Clears player state at Player_1_State, wave and score fields, and applies Messaging_ResetMargins (reset margins) when starting a fresh game.
|
||||
| PlayerDeath | D367 | LD A,($C532) | A=*DeathSequenceMode (death-sequence mode; 01 = skip the intro HUD/delay). | |
| D36A | CP $01 | Compare with 01. | ||
| D36C | JR Z,PlayerDeath_LoseLife | If set, jump to PlayerDeath_LoseLife to decrement Lives immediately. | ||
|
Full death sequence: redraw the HUD (RenderHUD), print Messaging_Player ("PLAYER") via PrintMessaging, then print the current player digit from *C41F as ASCII (30–39).
|
||||
| D36E | CALL RenderHUD | Call RenderHUD. | ||
| D371 | LD HL,$D347 | Call PrintMessaging using Messaging_Player. | ||
| D374 | CALL PrintMessaging | |||
| D377 | LD A,($C41F) | A=*C41F (player index for the digit). | ||
| D37A | ADD A,%00110000 | Convert to ASCII ("0"–"9"). | ||
| D37C | CALL PrintDispatch | Call PrintDispatch (print dispatch). | ||
| D37F | LD B,$20 | Inner delay loop count 20 (B=20). | ||
| PlayerDeath_IntroDelay | D381 | PUSH BC | Stash BC on the stack. | |
| D382 | CALL $DAA3 | Call DAA3 (short delay). | ||
| D385 | CALL $C713 | Call C713 (attribute bar). | ||
| D388 | POP BC | Restore BC from the stack. | ||
| D389 | DJNZ PlayerDeath_IntroDelay | Decrease counter and loop back to PlayerDeath_IntroDelay until the intro delay finishes. | ||
| PlayerDeath_LoseLife | D38B | LD HL,$C415 | HL=Lives (lives counter). | |
| D38E | DEC (HL) | Decrease *HL (lose one life). | ||
| D38F | CALL $D24C | Call D24C (re-stage the wave / death handling). | ||
| D392 | LD A,($C415) | Jump to PlayerDeath_GameOver if *Lives shows no lives are left. | ||
| D395 | AND A | |||
| D396 | JR Z,PlayerDeath_GameOver | |||
|
Lives remain: swap to the other player and continue if two-player mode.
|
||||
| D398 | CALL SwapPlayerState | Call SwapPlayerState. | ||
|
If not two-player, jump back to PlayerDeath for the same player.
|
||||
| D39B | LD A,($C41E) | Jump back to PlayerDeath if *TwoPlayerSessionFlag is not set. | ||
| D39E | CP $01 | |||
| D3A0 | JR NZ,PlayerDeath | |||
| D3A2 | CALL SwapPlayerState | Call SwapPlayerState (swap back). | ||
| D3A5 | JR PlayerDeath | Jump back to PlayerDeath. | ||
|
No lives left: redraw the HUD, then either the "PLAYER" line or straight to "GAME OVER" depending on *DeathSequenceMode, with a longer delay loop.
|
||||
| PlayerDeath_GameOver | D3A7 | CALL RenderHUD | Call RenderHUD. | |
| D3AA | LD A,($C532) | Jump to PlayerDeath_GameOverDelay if *DeathSequenceMode is 01. | ||
| D3AD | CP $01 | |||
| D3AF | JR Z,PlayerDeath_GameOverDelay | |||
| D3B1 | LD HL,$D347 | Call PrintMessaging using Messaging_Player. | ||
| D3B4 | CALL PrintMessaging | |||
| D3B7 | LD A,($C41F) | A=*C41F. | ||
| D3BA | ADD A,%00110000 | Convert to ASCII. | ||
| D3BC | CALL PrintDispatch | Call PrintDispatch. | ||
| PlayerDeath_GameOverDelay | D3BF | LD HL,$D356 | Call PrintMessaging using Messaging_GameOver. | |
| D3C2 | CALL PrintMessaging | |||
| D3C5 | LD B,$29 | Longer delay loop count 29 (B=29). | ||
| PlayerDeath_GameOverDelayLoop | D3C7 | PUSH BC | Stash BC on the stack. | |
| D3C8 | CALL $DAA3 | Call DAA3. | ||
| D3CB | CALL $C713 | Call C713. | ||
| D3CE | POP BC | Restore BC from the stack. | ||
| D3CF | DJNZ PlayerDeath_GameOverDelayLoop | Decrease counter and loop back to PlayerDeath_GameOverDelayLoop. | ||
|
Set *TwoPlayerSessionFlag to 01 swap players with SwapPlayerState, then branch on the flag read back from *TwoPlayerSessionFlag.
|
||||
| D3D1 | LD A,$01 | Write 01 to *TwoPlayerSessionFlag. | ||
| D3D3 | LD ($C41E),A | |||
| D3D6 | CALL SwapPlayerState | Call SwapPlayerState. | ||
| D3D9 | LD A,($C41E) | Jump to GameEntryPoint if *TwoPlayerSessionFlag is 01 (attract mode). | ||
| D3DC | CP $01 | |||
| D3DE | JP Z,GameEntryPoint | |||
| D3E1 | JP PlayerDeath | Jump back to PlayerDeath. | ||
| Prev: D356 | Up: Map | Next: D3E4 |