Prev: ECAF Up: Map Next: ED12
ECBF: Controller: Game Over
Used by the routines at Game_Loop and GameOver.
First draw a yellow "GAME OVER":
game-over-01
Controller_GameOver ECBF LD C,$36 C=INK: YELLOW, PAPER: YELLOW .
ECC1 XOR A Set *GameOver_X_Offset to 00.
ECC2 LD ($EDEF),A
ECC5 LD A,$01 Set *GameOver_Y_Offset to 01.
ECC7 LD ($EDF0),A
ECCA CALL Draw_GameOver Call Draw_GameOver.
Then, a little offset to the first one, draw a cyan "GAME OVER".
game-over-02
ECCD LD C,$6D C=INK: CYAN, PAPER: CYAN (BRIGHT) .
ECCF XOR A Set *GameOver_Y_Offset to 00.
ECD0 LD ($EDF0),A
ECD3 CALL Draw_GameOver Call Draw_GameOver.
Now flash the "GAME OVER" cycling down and back up through the following colours:
  • 49: INK: BLUE, PAPER: BLUE (BRIGHT)
  • 52: INK: RED, PAPER: RED (BRIGHT)
  • 5B: INK: MAGENTA, PAPER: MAGENTA (BRIGHT)
  • 64: INK: GREEN, PAPER: GREEN (BRIGHT)
  • 6D: INK: CYAN, PAPER: CYAN (BRIGHT)
  • 76: INK: YELLOW, PAPER: YELLOW (BRIGHT)
  • 7F: INK: WHITE, PAPER: WHITE (BRIGHT)
game-over-03-animation
ECD6 LD B,$0A Set a counter in B of 0A to count the number of down/ up cycles here.
GameOver_Flash_Loop ECD8 LD A,$01 Set *GameOver_X_Offset to 01.
ECDA LD ($EDEF),A
ECDD PUSH BC Stash the colour loop counter on the stack.
First cycle down, starting at: INK: WHITE, PAPER: WHITE (BRIGHT) (7F).
ECDE LD C,$7F Set the starting colour value in C to INK: WHITE, PAPER: WHITE (BRIGHT) .
CycleDown_Loop ECE0 CALL Draw_GameOver Call Draw_GameOver.
ECE3 LD A,C Jump to CycleUp_Loop if the current colour is: INK: BLUE, PAPER: BLUE (BRIGHT) (49).
ECE4 CP $49
ECE6 JR Z,CycleUp_Loop
ECE8 SUB $09 Subtract 09 from the current colour value and store the result back in C.
ECEA LD C,A
ECEB CALL GameOver_FlashOffset Call GameOver_FlashOffset.
ECEE JR CycleDown_Loop Jump to CycleDown_Loop.
Next cycle back up again; on first entry, starting at INK: BLUE, PAPER: BLUE (BRIGHT) (49).
CycleUp_Loop ECF0 LD A,C Jump to GameOver_Cycle_Next if the current colour is: INK: YELLOW, PAPER: YELLOW (BRIGHT) (76).
ECF1 CP $76
ECF3 JR Z,GameOver_Cycle_Next
ECF5 ADD A,$09 Add 09 to the current colour value and store the result back in C.
ECF7 LD C,A
ECF8 CALL Draw_GameOver Call Draw_GameOver.
ECFB CALL GameOver_FlashOffset Call GameOver_FlashOffset.
ECFE JR CycleUp_Loop Jump to CycleUp_Loop.
Handle the flash loop.
GameOver_Cycle_Next ED00 POP BC Restore the cycle counter from the stack.
ED01 DJNZ GameOver_Flash_Loop Decrease the cycle counter by one and loop back to GameOver_Flash_Loop until the cycle has repeated 0A times.
ED03 LD B,$02 B=02.
Controller_GameOver_0 ED05 PUSH BC Stash BC on the stack.
ED06 LD HL,$ED12 HL=ED12.
ED09 LD B,$28 B=28.
ED0B CALL $EF6A Call EF6A.
ED0E POP BC Restore BC from the stack.
ED0F DJNZ Controller_GameOver_0 Decrease counter by one and loop back to Controller_GameOver_0 until counter is zero.
ED11 RET Return.
Prev: ECAF Up: Map Next: ED12