![]() |
Routines |
| Prev: 6CC9 | Up: Map | Next: 6DCF |
|
Used by the routines at TitleScreen and StartGame.
|
||||
| Handler_PlayerDeathGameOver | 6CEE | LD HL,$66A4 | Jump to Handler_Shield if *Flag_Collision is zero. | |
| 6CF1 | LD A,(HL) | |||
| 6CF2 | OR A | |||
| 6CF3 | JP Z,Handler_Shield | |||
| 6CF6 | INC HL | Jump to GameOver if *Explosion_Counter is not equal to 40. | ||
| 6CF7 | LD A,(HL) | |||
| 6CF8 | CP $40 | |||
| 6CFA | JR NZ,GameOver | |||
| 6CFC | DEC HL | Write 02 ("explosion complete") to *Flag_Collision. | ||
| 6CFD | LD (HL),$02 | |||
| 6CFF | RET | Return. | ||
|
Handles the "Game Over" state.
|
||||
| GameOver | 6D00 | LD A,($6695) | Jump to Handler_PlayerBullets if *Bullet_RateLimiter is not zero. | |
| 6D03 | OR A | |||
| 6D04 | JP NZ,Handler_PlayerBullets | |||
| 6D07 | LD A,($66F0) | Jump to GameOver_Explosion if *Player_Lives is not equal to 01. | ||
| 6D0A | CP $01 | |||
| 6D0C | JR NZ,GameOver_Explosion | |||
| 6D0E | LD A,($66F3) | Jump to GameOver_Explosion if *Flag_ActiveDemoMode is active. | ||
| 6D11 | OR A | |||
| 6D12 | JR NZ,GameOver_Explosion | |||
| 6D14 | PUSH HL | Stash HL on the stack. | ||
|
Prints
|
||||
| 6D15 | LD HL,$646E | HL=Messaging_GameOver. | ||
| 6D18 | LD DE,$48CB | DE=48CB (screen buffer location). | ||
| 6D1B | LD BC,$0445 | Set to print 04 characters in INK:CYAN, PAPER:BLACK (BRIGHT). | ||
| 6D1E | CALL Configurable_PrintString | Call Configurable_PrintString. | ||
|
Prints
|
||||
| 6D21 | LD E,$D1 | Update the screen buffer address. | ||
| 6D23 | LD B,$04 | Set to print 04 characters. | ||
| 6D25 | CALL Configurable_PrintString | Call Configurable_PrintString. | ||
| 6D28 | POP HL | Restore HL from the stack. | ||
|
Animate the explosion effect.
|
||||
| GameOver_Explosion | 6D29 | LD A,(HL) | A=*HL. | |
| 6D2A | AND %00000111 | Keep only bits 0-2. | ||
| 6D2C | BIT 3,(HL) | Jump to GameOver_SkipIncrement if bit 3 of *HL is set. | ||
| 6D2E | JR NZ,GameOver_SkipIncrement | |||
| 6D30 | INC A | Increment A by one. | ||
| GameOver_SkipIncrement | 6D31 | INC (HL) | Increment the explosion counter by two. | |
| 6D32 | INC (HL) | |||
| 6D33 | LD C,A | Copy the attribute value to C. | ||
| 6D34 | LD B,$00 | B=00. | ||
| 6D36 | LD IX,$0002 | IX=02. | ||
| GameOver_ExplosionLoop | 6D3A | PUSH BC | Stash the colour counter on the stack. | |
| 6D3B | LD HL,($66ED) | HL=*PlayerAttributeBufferPosition. | ||
| 6D3E | LD DE,$0021 | HL+=0021. | ||
| 6D41 | ADD HL,DE | |||
| 6D42 | LD (HL),D | Write D to *HL. | ||
| 6D43 | PUSH HL | Stash HL on the stack. | ||
| 6D44 | LD A,L | A=L. | ||
| 6D45 | AND %00011111 | Keep only bits 0-4. | ||
| 6D47 | SUB C | A-=C. | ||
| 6D48 | PUSH AF | Stash AF on the stack. | ||
| 6D49 | AND A | HL-=BC. | ||
| 6D4A | SBC HL,BC | |||
| 6D4C | POP AF | Restore AF from the stack. | ||
| 6D4D | CALL NC,Handler_ShipExplosion | Call Handler_ShipExplosion if A is greater than 00. | ||
| 6D50 | POP HL | Restore HL from the stack. | ||
| 6D51 | PUSH HL | Stash HL on the stack. | ||
| 6D52 | LD A,L | A=L. | ||
| 6D53 | AND %00011111 | Keep only bits 0-4. | ||
| 6D55 | ADD A,C | A+=C. | ||
| 6D56 | CP $20 | Compare A with 20. | ||
| 6D58 | PUSH AF | Stash AF on the stack. | ||
| 6D59 | ADD HL,BC | HL+=BC. | ||
| 6D5A | POP AF | Restore AF from the stack. | ||
| 6D5B | CALL C,Handler_ShipExplosion | Call Handler_ShipExplosion if A is less than 20. | ||
| 6D5E | POP HL | Restore HL from the stack. | ||
| 6D5F | PUSH HL | Stash HL on the stack. | ||
| 6D60 | LD B,C | B=C. | ||
| 6D61 | LD DE,$0020 | HL-=0020 (with carry). | ||
| Handler_PlayerDeathGameOver_0 | 6D64 | AND A | ||
| 6D65 | SBC HL,DE | |||
| 6D67 | DJNZ Handler_PlayerDeathGameOver_0 | Decrease counter by one and loop back to Handler_PlayerDeathGameOver_0 until counter is zero. | ||
| 6D69 | CALL Handler_ShipExplosion | Call Handler_ShipExplosion. | ||
| 6D6C | POP HL | Restore HL from the stack. | ||
| 6D6D | LD A,C | A=C. | ||
| 6D6E | SUB $02 | A-=02. | ||
| 6D70 | LD B,A | B=A. | ||
| 6D71 | JR C,Handler_PlayerDeathGameOver_2 | Jump to Handler_PlayerDeathGameOver_2 if A is less than A. | ||
| 6D73 | JR Z,Handler_PlayerDeathGameOver_2 | Jump to Handler_PlayerDeathGameOver_2 if A is zero. | ||
| 6D75 | PUSH HL | Stash HL on the stack. | ||
| 6D76 | LD DE,$0021 | DE=0021. | ||
| 6D79 | LD A,L | A=L. | ||
| 6D7A | AND %00011111 | Keep only bits 0-4. | ||
| 6D7C | ADD A,$02 | A+=02. | ||
| 6D7E | SUB C | A-=C. | ||
| 6D7F | PUSH AF | Stash AF on the stack. | ||
| Handler_PlayerDeathGameOver_1 | 6D80 | AND A | HL-=DE (with carry). | |
| 6D81 | SBC HL,DE | |||
| 6D83 | DJNZ Handler_PlayerDeathGameOver_1 | Decrease counter by one and loop back to Handler_PlayerDeathGameOver_1 until counter is zero. | ||
| 6D85 | POP AF | Restore AF from the stack. | ||
| 6D86 | CALL NC,Handler_ShipExplosion | Call Handler_ShipExplosion if A is greater than 00. | ||
| 6D89 | POP HL | Restore HL from the stack. | ||
| Handler_PlayerDeathGameOver_2 | 6D8A | LD A,C | A=C. | |
| 6D8B | SUB $02 | A-=02. | ||
| 6D8D | LD B,A | B=A. | ||
| 6D8E | JR C,Handler_PlayerDeathGameOver_4 | Jump to Handler_PlayerDeathGameOver_4 if A is less than A. | ||
| 6D90 | JR Z,Handler_PlayerDeathGameOver_4 | Jump to Handler_PlayerDeathGameOver_4 if A is zero. | ||
| 6D92 | LD DE,$001F | DE=001F. | ||
| 6D95 | LD A,L | A=L. | ||
| 6D96 | AND E | Merge the bits from E. | ||
| 6D97 | ADD A,C | A+=C. | ||
| 6D98 | CP $22 | Compare A with 22. | ||
| 6D9A | PUSH AF | Stash AF on the stack. | ||
| Handler_PlayerDeathGameOver_3 | 6D9B | AND A | HL-=DE (with carry). | |
| 6D9C | SBC HL,DE | |||
| 6D9E | DJNZ Handler_PlayerDeathGameOver_3 | Decrease counter by one and loop back to Handler_PlayerDeathGameOver_3 until counter is zero. | ||
| 6DA0 | POP AF | Restore AF from the stack. | ||
| 6DA1 | CALL C,Handler_ShipExplosion | Call Handler_ShipExplosion if A is less than 00. | ||
| Handler_PlayerDeathGameOver_4 | 6DA4 | POP BC | Restore BC from the stack. | |
| 6DA5 | INC C | Increment C by one. | ||
| 6DA6 | DEC IXl | |||
| 6DA8 | JR NZ,GameOver_ExplosionLoop | Jump to GameOver_ExplosionLoop if ?? is not equal to 00. | ||
| 6DAA | LD A,($66F3) | Jump to Handler_PlayerBullets if *Flag_ActiveDemoMode is not active. | ||
| 6DAD | OR A | |||
| 6DAE | JP NZ,Handler_PlayerBullets | |||
| 6DB1 | LD A,($66A5) | A=*Explosion_Counter. | ||
| 6DB4 | AND %00000011 | Keep only bits 0-1. | ||
| 6DB6 | JP NZ,Handler_PlayerBullets | Jump to Handler_PlayerBullets if the result is not equal to zero. | ||
|
|
||||
| 6DB9 | LD B,$08 | Set sound loop counter to 08. | ||
| GameOver_SoundLoop | 6DBB | LD A,B | Copy the sound loop counter into A and add 19. | |
| 6DBC | ADD A,$19 | |||
| 6DBE | AND %00011000 | Keep only bits 3-4. | ||
| 6DC0 | DI | Disable interrupts. | ||
| 6DC1 | OUT ($FE),A | Send to the speaker. | ||
| 6DC3 | PUSH BC | Stash the sound loop counter on the stack. | ||
| GameOver_SoundDelay | 6DC4 | DJNZ GameOver_SoundDelay | Decrease the delay loop counter by one and loop back to GameOver_SoundDelay until the counter is zero. | |
| 6DC6 | POP BC | Restore the sound loop counter from the stack. | ||
| 6DC7 | DJNZ GameOver_SoundLoop | Decrease the sound loop counter by one and loop back to GameOver_SoundLoop until the sound has played out. | ||
| 6DC9 | XOR A | Turn the speaker off. | ||
| 6DCA | OUT ($FE),A | |||
| 6DCC | JP Handler_PlayerBullets | Jump to Handler_PlayerBullets. | ||
| Prev: 6CC9 | Up: Map | Next: 6DCF |