Prev: CD9A Up: Map Next: CE53
CDD3: Display the "game over" sequence
Used by the routine at CD9A.
CDD3 POP HL Tidy the stack, so returning from here will go back to the main entry point.
CDD4 POP HL
CDD5 LD HL,$C87F Point HL at some flags. (#$C87F)
CDD8 SET 7,(HL) Set bit 7 (laser firing)
This entry point is used by the routine at DBEE.
CDDA CALL $E820 Clear the screen to cyan ink / black paper.
CDDD LD HL,$E800 Put the last read state of port FE in A.
CDE0 LD A,(HL)
CDE1 AND $F8 Keep only the top 5 bits, this ensures a black border is set.
CDE3 LD (HL),A
CDE4 OUT ($FE),A Set the border colour.
CDE6 LD HL,$DA8A Get the current sound state. (DA8A)
CDE9 LD (HL),$00 Turn all sound off, the game's over.
CDEB LD HL,$CE68 Point HL towards Blitzen on the "game over" screen.
CDEE CALL $ED06 Print it.
CDF1 LD HL,$E6D9 Point HL at the tick count for lasers.
CDF4 LD (HL),$7F Set it so it will fire immediately.
CDF6 INC HL Start drawing the laser bolt in black.
CDF7 LD (HL),$00
CDF9 LD IY,$CE72 Point IY at Blitzen's laser data. (CE72)
CDFD CALL $E6F6 Update the laser.
CE00 LD HL,$DA8A Get the current sound state. (DA8A)
CE03 RES 1,(HL) Reset bit 1 to play a sound effect.
CE05 CALL $DA8D Play the sound.
CE08 LD A,($E6DA) Put the current laser colour in A.
CE0B CALL $F021 Animate Dan dying.
CE0E CALL $C92A Update the main status area.
CE11 LD A,($E6DA) Get the current laser colour.
CE14 AND A Is it zero?
CE15 JR NZ,$CDFD Jump forward if it isn't.
CE17 LD A,$B8 Point Blitzen to the next UDG. (92B4)
CE19 PUSH AF Remember AF.
CE1A CALL $F3D3 Convert the UDG into an address.
CE1D LD DE,$0209 Set the size in DE.
CE20 CALL $E84E Draw the UDG.
CE23 CALL $DAFA Pause.
CE26 CALL $C92A Update the main status area.
CE29 CALL $DA8D Play the laser sound.
CE2C POP AF Restore AF.
CE2D INC A Move to the next UDG for Blitzen.
CE2E CP $BB Have we reached the final one? (9487)
CE30 JR NZ,$CE19 Loop back to draw the next one if not.
CE32 CALL $C92A Update the main status area.
CE35 CALL $DA8D Play the laser sound.
CE38 CALL $DAFA Pause.
CE3B LD A,($C86B) Is there anything to be added to the final score?
CE3E AND A
CE3F JR NZ,$CE32 Loop back until there isn't.
The final score has been updated and Dan has been killed by Blitzen.
CE41 LD HL,$CE53 Point HL at the "screens visited" message. (CE53)
CE44 CALL $DDE0 Print the message.
CE47 LD B,$32 Loop round the pause routine this many times.
CE49 PUSH BC Pause.
CE4A CALL $DAFA
CE4D POP BC
CE4E DJNZ $CE49 Loop until all iterations completed.
CE50 JP $C804 Jump back to start a new game.
Prev: CD9A Up: Map Next: CE53