![]() |
Routines |
| Prev: 7C82 | Up: Map | Next: 7E47 |
|
Used by the routine at TitleScreen.
|
||||
|
First collect the control method.
|
||||
| StartGame | 7DD9 | CALL Print_ControlMenu | Call Print_ControlMenu. | |
|
This is a game the player started, so disable the demo mode and unset the game-over flag.
|
||||
| 7DDC | XOR A | Write 00 to; | ||
| 7DDD | LD ($66F5),A | |||
| 7DE0 | LD ($66F3),A | |||
| 7DE3 | INC A | Write 01 to *Flag_ExtraLife. | ||
| 7DE4 | LD ($66EF),A | |||
| 7DE7 | LD A,$04 | Write 04 to *Phase. | ||
| 7DE9 | LD ($66F1),A | |||
|
Set the players starting life count.
|
||||
| 7DEC | INC A | Write 05 to *Player_Lives. | ||
| 7DED | LD ($66F0),A | |||
| 7DF0 | CALL InitialiseLevel | Call InitialiseLevel. | ||
| Game_Loop | 7DF3 | CALL Handler_PlayerDeathGameOver | Call Handler_PlayerDeathGameOver. | |
| 7DF6 | CALL Handler_AliensMovement_Spawning | Call Handler_AliensMovement_Spawning. | ||
| 7DF9 | CALL Handler_Aliens | Call Handler_Aliens. | ||
| 7DFC | CALL Handler_AlienExplosions | Call Handler_AlienExplosions. | ||
| 7DFF | CALL Handler_LevelReset | Call Handler_LevelReset. | ||
| 7E02 | CALL DifficultyDelay | Call DifficultyDelay. | ||
| 7E05 | LD A,($66F5) | Jump back to Game_Loop unless *Flag_GameOver is active. | ||
| 7E08 | OR A | |||
| 7E09 | JR Z,Game_Loop | |||
|
*Flag_GameOver is active, start the "Game Over" process.
|
||||
| 7E0B | LD D,$08 | Set an outer loop counter in D for 08 loops. | ||
| GameOver_PauseOuterLoop | 7E0D | LD BC,$0000 | Set an inner counter in BC of 0000 (10000 as it decreases by one in the loop). | |
| GameOver_PauseInnerLoop | 7E10 | DJNZ GameOver_PauseInnerLoop | Decrease the counter in B by one and loop back to GameOver_PauseInnerLoop until the counter is zero. | |
| 7E12 | DEC C | Decrease C by one. | ||
| 7E13 | JR NZ,GameOver_PauseInnerLoop | Jump back to GameOver_PauseInnerLoop until C is zero. | ||
| 7E15 | DEC D | Decrease the outer loop counter by one. | ||
| 7E16 | JR NZ,GameOver_PauseOuterLoop | Jump back to GameOver_PauseOuterLoop until the outer loop is zero. | ||
|
Did the player achieve a new high score?
|
||||
| 7E18 | LD HL,$6514 | HL=Messaging_Score. | ||
| 7E1B | LD DE,$651F | DE=Messaging_HighScore. | ||
| 7E1E | LD B,$06 | Set a length counter in B for 06 score digits to compare. | ||
| 7E20 | PUSH HL | Stash the score and highscore pointers on the stack. | ||
| 7E21 | PUSH DE | |||
| CompareScoreDigit | 7E22 | LD A,(DE) | Jump to CheckNextScoreDigit if the players score digit is equal to the same digit of the highscore. | |
| 7E23 | CP (HL) | |||
| 7E24 | JR Z,CheckNextScoreDigit | |||
| 7E26 | JR C,SetHighScore | Jump to SetHighScore if the players score digit is less than the same digit of the highscore. | ||
| 7E28 | JR ScoresAreBothEqual | Jump to ScoresAreBothEqual. | ||
|
Move to the next digits of the score/ highscore.
|
||||
| CheckNextScoreDigit | 7E2A | INC DE | Move to the next digit of the score. | |
| 7E2B | INC HL | Move to the next digit of the highscore. | ||
| 7E2C | DJNZ CompareScoreDigit | Decrease counter by one and loop back to CompareScoreDigit until all digits of the scores have been compared. | ||
|
If we got here then the scores are the same so don't do anything/ treat this as though the score was less than the highscore and move on and reset.
|
||||
| ScoresAreBothEqual | 7E2E | POP DE | Restore the highscore pointer from the stack. | |
| 7E2F | JR Reset_ScoreMessaging | Jump to Reset_ScoreMessaging. | ||
|
A new highscore has been achieved, so overwrite the current highscore.
|
||||
| SetHighScore | 7E31 | POP DE | Restore the score and highscore pointers from the stack. | |
| 7E32 | POP HL | |||
| 7E33 | PUSH HL | Stash the highscore pointer on the stack. | ||
| 7E34 | LD BC,$0006 | Copy 0006 bytes from the players score over to the highscore messaging buffer. | ||
| 7E37 | LDIR | |||
|
Reset the players score to "000000".
|
||||
| Reset_ScoreMessaging | 7E39 | POP HL | Restore the score pointer from the stack. | |
| 7E3A | LD DE,$6515 | Point the target (DE) to the second digit of the players score: 6515. | ||
| 7E3D | LD (HL),$30 | Write ASCII 30 ("0") to *HL. | ||
| 7E3F | LD BC,$0005 | Copy the "0" across the rest of the 0005 bytes of the score. | ||
| 7E42 | LDIR | |||
| 7E44 | JP TitleScreen | Jump to TitleScreen. | ||
| Prev: 7C82 | Up: Map | Next: 7E47 |