Prev: 6E10 Up: Map Next: 6F43
6E18: Handler: Game Over
Used by the routine at Game_Loop.
Handler_GameOver 6E18 CALL RemoveSprites Call RemoveSprites.
6E1B LD HL,($783A) HL=*783A.
6E1E LD A,(HL) A=*HL.
6E1F CP $F0 Jump to StartCarouselAnimation if A is higher than F0.
6E21 JR NC,StartCarouselAnimation
6E23 LD ($7834),A Write A to *PlayerSpriteID.
6E26 INC HL Increment HL by one.
6E27 LD A,(HL) A=*HL.
6E28 AND %00001111 Keep only bits 0-3.
6E2A LD ($781A),A Write A to *781A.
6E2D LD A,(HL) A=*HL.
6E2E INC HL Increment HL by one.
6E2F LD ($783A),HL Write HL to *783A.
6E32 LD HL,$7833 HL=PlayerPosition_Y.
6E35 RLCA RLCA.
6E36 JR NC,Handler_GameOver_0 Jump to Handler_GameOver_0 if {} is higher.
6E38 DEC (HL) Decrease *HL by one.
Handler_GameOver_0 6E39 RLCA RLCA.
6E3A JR NC,Handler_GameOver_1 Jump to Handler_GameOver_1 if {} is higher.
6E3C INC (HL) Increment *HL by one.
Handler_GameOver_1 6E3D RLCA RLCA.
6E3E JR NC,Handler_GameOver_2 Jump to Handler_GameOver_2 if {} is higher.
6E40 CALL ScrollPlayarea_Left Call ScrollPlayarea_Left.
6E43 CALL DrawPlayarea Call DrawPlayarea.
6E46 JR Handler_GameOver_3 Jump to Handler_GameOver_3.
Handler_GameOver_2 6E48 RLCA RLCA.
6E49 JR NC,Handler_GameOver_3 Jump to Handler_GameOver_3 if {} is higher.
6E4B CALL ScrollPlayarea_Right Call ScrollPlayarea_Right.
6E4E CALL DrawPlayarea Call DrawPlayarea.
Handler_GameOver_3 6E51 CALL Handler_PlayerSprite Call Handler_PlayerSprite.
6E54 CALL $6D50 Call 6D50.
StartCarouselAnimation 6E57 PUSH AF Stash AF on the stack.
6E58 NOP No operation.
6E59 NOP
6E5A NOP
6E5B NOP
6E5C NOP
6E5D NOP
6E5E CALL Handler_PlayerSprite Call Handler_PlayerSprite.
6E61 POP AF Restore AF from the stack.
6E62 AND %00001111 Keep only bits 0-3.
6E64 SUB $08 A-=08.
6E66 LD B,A B=A.
6E67 LD A,($7822) Fetch *Speed to determine if the player facing left or right?
6E6A BIT 7,A
6E6C LD A,$12 Set a default offset in A of 12.
6E6E JR Z,Handler_GameOver_4 Jump to Handler_GameOver_4 if the player is facing left.
The player is facing right.
6E70 LD A,$0D Change the offset in A to 0D.
Handler_GameOver_4 6E72 ADD A,B A+=B.
6E73 LD L,A L=A.
6E74 LD A,($7833) A=*PlayerPosition_Y.
6E77 SUB $02 A-=02.
6E79 LD H,$40 H=40.
6E7B CP $08 Jump to Handler_GameOver_5 if A is lower than 08.
6E7D JR C,Handler_GameOver_5
6E7F LD H,$48 H=48.
Handler_GameOver_5 6E81 AND %00000111 Keep only bits 0-2.
6E83 RRCA RRCA.
6E84 RRCA
6E85 RRCA
6E86 ADD A,L A+=L.
6E87 LD L,A L=A.
6E88 PUSH HL Stash HL on the stack.
6E89 DEC L Decrease L by two.
6E8A DEC L
6E8B LD DE,$78E0 DE=Graphics_Carousel.
6E8E LD C,$28 C=28.
6E90 EX DE,HL Exchange the DE and HL registers.
Handler_GameOver_6 6E91 LD B,$04 B=04.
Handler_GameOver_7 6E93 LDI LDI.
6E95 DJNZ Handler_GameOver_7 Decrease counter by one and loop back to Handler_GameOver_7 until counter is zero.
6E97 LD A,E A=E.
6E98 SUB $04 A-=04.
6E9A LD E,A E=A.
6E9B INC D Increment D by one.
6E9C DEC C Decrease C by one.
6E9D JR NZ,Handler_GameOver_6 Jump to Handler_GameOver_6 until C is zero.
6E9F LD A,D A=D.
6EA0 SUB $49 A-=49.
6EA2 SBC A,A A-=A.
6EA3 ADD A,$59 A+=59.
6EA5 LD D,A D=A.
6EA6 LD B,$04 Set a counter in B of 04 for the width of the carousel.
Paint the carousel.
6EA8 LD A,$06 A=INK: YELLOW, PAPER: BLACK .
ColourCarousel_Loop 6EAA LD (DE),A Write the attribute byte to the attribute buffer address in *DE.
6EAB INC E Move to the next attribute buffer position.
6EAC DJNZ ColourCarousel_Loop Decrease the carousel width counter by one and loop back to ColourCarousel_Loop until all of the carousel has been painted.
6EAE POP HL Restore HL from the stack.
Play the "player dead" audio.
6EAF LD B,$14 B=14 (counter; 14 loops).
Handler_PlayerDead 6EB1 PUSH BC Stash BC and HL on the stack.
6EB2 PUSH HL
6EB3 LD A,B A=B.
6EB4 AND %00000111 Keep only bits 0-2.
6EB6 LD D,$00 D=00.
PlayAudioDead 6EB8 OUT ($FE),A Send to the speaker.
6EBA XOR %00010000 Flip the speaker (bit 4) on/ off.
6EBC LD B,D B=D.
AudioDead_Loop 6EBD DJNZ AudioDead_Loop Decrease counter by one and loop back to AudioDead_Loop until counter is zero.
6EBF DEC D Decrease D by one.
6EC0 JR NZ,PlayAudioDead Jump to PlayAudioDead until D is zero.
6EC2 LD B,$08 B=08 (counter; height of the carousel).
Carousel_Loop 6EC4 XOR A A=00.
6EC5 RLD RLD.
6EC7 DEC L Decrease L by one.
6EC8 RLD RLD.
6ECA INC L Increment L by one.
6ECB OR (HL) Set the bits from *HL.
6ECC LD (HL),A Write A to *HL.
6ECD INC H Increment H by one.
6ECE DJNZ Carousel_Loop Decrease counter by one and loop back to Carousel_Loop until counter is zero.
6ED0 POP HL Restore HL and BC from the stack.
6ED1 POP BC
6ED2 DJNZ Handler_PlayerDead Decrease counter by one and loop back to Handler_PlayerDead until counter is zero.
This entry point is used by the routines at Check_DemoMode and Handler_GhostRider.
Handler_GameOver_8 6ED4 CALL RemoveSprites Call RemoveSprites.
6ED7 LD A,($7838) A=*7838.
6EDA BIT 7,A Test bit 7 of A.
6EDC LD HL,$BB00 HL=BB00.
6EDF LD A,$80 A=80.
6EE1 JR Z,Handler_GameOver_9 Jump to Handler_GameOver_9 if {} is zero.
6EE3 DEC A Decrease A by one.
6EE4 LD L,$04 L=04.
Handler_GameOver_9 6EE6 LD ($7831),HL Write HL to *7831.
6EE9 LD HL,$7830 HL=7830.
6EEC LD (HL),$03 Write 03 to *HL.
6EEE JR Z,Handler_GameOver_10 Jump to Handler_GameOver_10 if {} is zero.
6EF0 INC (HL) Increment *HL by one.
Handler_GameOver_10 6EF1 LD L,$21 L=21.
6EF3 LD B,$03 B=03.
Handler_GameOver_11 6EF5 LD (HL),A Write A to *HL.
6EF6 INC L Increment L by one.
6EF7 DJNZ Handler_GameOver_11 Decrease counter by one and loop back to Handler_GameOver_11 until counter is zero.
6EF9 LD B,$08 B=08.
Handler_GameOver_12 6EFB LD (HL),$00 Write 00 to *HL.
6EFD INC L Increment L by one.
6EFE DJNZ Handler_GameOver_12 Decrease counter by one and loop back to Handler_GameOver_12 until counter is zero.
6F00 LD L,$1A L=1A.
6F02 LD (HL),$01 Write 01 to *HL.
6F04 LD HL,$0000 Write 0000 to *7814.
6F07 LD ($7814),HL
6F0A LD HL,($7836) Write *7836 to *LevelProgressPointer.
6F0D LD ($782E),HL
6F10 BIT 7,A Test bit 7 of A.
6F12 LD B,$03 B=03.
6F14 JR NZ,Handler_GameOver_13 Jump to Handler_GameOver_13 if {} is not zero.
6F16 INC B Increment B by one.
Handler_GameOver_13 6F17 LD A,H A=H.
6F18 SUB $99 A-=99.
Handler_GameOver_14 6F1A SUB $05 A-=05.
6F1C JR NC,Handler_GameOver_14 Jump to Handler_GameOver_14 if {} is higher.
6F1E ADD A,$05 A+=05.
6F20 ADD A,A A+=A.
6F21 ADD A,A A+=A.
6F22 DEC A Decrease A by one.
6F23 LD ($7833),A Write A to *PlayerPosition_Y.
6F26 LD A,$9E A=9E.
Handler_GameOver_15 6F28 ADD A,$05 A+=05.
6F2A CP H Jump to Handler_GameOver_15 if A is lower than H.
6F2B JR C,Handler_GameOver_15
6F2D SUB $05 A-=05.
6F2F LD H,A H=A.
6F30 LD A,L L-=B.
6F31 SUB B
6F32 LD L,A
6F33 JR NC,Handler_GameOver_16 Jump to Handler_GameOver_16 if {} is higher.
6F35 LD A,H H-=05.
6F36 SUB $05
6F38 LD H,A
Handler_GameOver_16 6F39 XOR A A=00.
6F3A CALL $6800 Call 6800.
6F3D CALL SpendLife Call SpendLife.
6F40 CALL GameInitialisation_5 Call GameInitialisation_5.
Prev: 6E10 Up: Map Next: 6F43