![]() |
Routines |
| Prev: CC36 | Up: Map | Next: CCE4 |
|
Used by the routines at NEW_LIFE and CHECK_QUEST_DONE.
Reached when the last life is taken (NEW_LIFE) and when the fourth villain's sparkles have finished (CHECK_QUEST_DONE). Works out the percentage (PERCENTAGE), clears the screen, draws the border round it (PRINT_BORDER) and prints the four lines of END_TEXT, the percentage after the third and the score after the fourth, then plays the game-over tune and waits half a second.
If any of the four villains is still alive (graphics 96-111) it is back to the menu, by way of NEW_GAME. If none is, the ending: every object record is emptied (CLEAR_OBJECTS), ten are filled from ENDING_RECORDS, the screen is cleared again, ENDING is set and the main loop is entered; with ENDING set the main loop only updates the records, and the ending's routines (ENDING_PIT_FRONT, ENDING_VILLAIN) do the rest.
|
||||
| GAME_OVER | CC56 | CALL PERCENTAGE | the percentage | |
| CC59 | CALL CLEAR_SCREEN | a clear screen, and the border round it | ||
| CC5C | CALL PRINT_BORDER | |||
| CC5F | LD HL,$8758 | the first line at (88, 135), in its own colour | ||
| CC62 | LD DE,END_TEXT | |||
| CC65 | CALL PRINT_TEXT | |||
| CC68 | LD HL,$6F38 | the next three, each at its place, DE running on through the text | ||
| CC6B | CALL PRINT_TEXT | |||
| CC6E | LD HL,$5F48 | |||
| CC71 | CALL PRINT_TEXT | |||
| CC74 | LD HL,$4748 | |||
| CC77 | CALL PRINT_TEXT | |||
| CC7A | LD HL,$4894 | the percentage after COMPLETED, at row 12, column 20, in cyan | ||
| CC7D | LD A,$45 | |||
| CC7F | EX AF,AF' | |||
| CC80 | CALL PRINT_PERCENTAGE | |||
| CC83 | LD HL,$48F0 | the score after SCORE, at row 15, column 16, in yellow | ||
| CC86 | LD A,$46 | |||
| CC88 | EX AF,AF' | |||
| CC89 | CALL PRINT_SCORE_AT | |||
| CC8C | LD DE,TUNE_GAME_OVER | the game-over tune | ||
| CC8F | CALL PLAY_TUNE | |||
| CC92 | LD B,$04 | a pause (the B it sets is not used) | ||
| CC94 | CALL GAME_OVER_PAUSE | |||
| CC97 | LD HL,VILLAINS | a villain still alive (96-111): the menu and a new game | ||
| CC9A | LD DE,$0010 | |||
| CC9D | LD B,$04 | |||
| GAME_OVER_0 | CC9F | LD A,(HL) | ||
| CCA0 | SUB $60 | |||
| CCA2 | CP $10 | |||
| CCA4 | JP C,NEW_GAME | |||
| CCA7 | ADD HL,DE | |||
| CCA8 | DJNZ GAME_OVER_0 | |||
| CCAA | CALL CLEAR_OBJECTS | the ending: every record empty, then ten from the ending's list | ||
| CCAD | LD IX,KNIGHT | |||
| CCB1 | LD HL,ENDING_RECORDS | |||
| CCB4 | LD DE,$0010 | |||
| CCB7 | LD B,$0A | |||
| GAME_OVER_1 | CCB9 | LD A,(HL) | the graphic, and the screen x and y in the step bytes | |
| CCBA | INC HL | |||
| CCBB | LD (IX+$00),A | |||
| CCBE | LD A,(HL) | |||
| CCBF | INC HL | |||
| CCC0 | LD (IX+$0A),A | |||
| CCC3 | LD A,(HL) | |||
| CCC4 | INC HL | |||
| CCC5 | LD (IX+$0B),A | |||
| CCC8 | XOR A | no flags, no drawing offset | ||
| CCC9 | LD (IX+$07),A | |||
| CCCC | LD (IX+$0C),A | |||
| CCCF | LD (IX+$0D),A | |||
| CCD2 | ADD IX,DE | |||
| CCD4 | DJNZ GAME_OVER_1 | |||
| CCD6 | CALL CLEAR_SCREEN | a clear screen; ENDING set; a clear buffer | ||
| CCD9 | LD A,$01 | |||
| CCDB | LD (ENDING),A | |||
| CCDE | CALL CLEAR_BUFFER | |||
| CCE1 | JP MAIN_LOOP | and the main loop, which with ENDING set only updates the records | ||
|
It is jumped to from inside routines the main loop calls, and ends by jumping to NEW_GAME or to MAIN_LOOP in it, which never set the stack pointer again (only START does): every game over leaves two bytes on the stack, and every ending four. Measured over four games and an ending, the stack pointer at the menu went down by exactly that each time. It would take about 150 games in one sitting for the stack to grow down through the rest of the BASIC program into the system variables and over NMIADD, the JP (HL) every update goes through.
|
||||
| Prev: CC36 | Up: Map | Next: CCE4 |