.StartNewGame \ We start by initialising the scores and \ printing them on the score bar LDR R0, [R11, #highScore] \ Set R0 to the current high score LDR R1, [R11, #currentScore] \ Set R1 to our current score CMP R1, R0 \ If R1 - R0 is positive, i.e. R1 >= R0, MOVPL R0, R1 \ then our latest score is higher than the \ high score, so set R0 to our latest score \ \ So R0 is set to the maximum of highScore \ and currentScore, which is the new high \ score STRHS R0, [R11, #highScore] \ If R1 >= R0 then we just updated the high \ score and the new high score is in R0, so \ store the new high score in highScore MOV R1, #35 \ Set (R1, R2) = (35, 1) so the following MOV R2, #1 \ call to PrintScoreInBothBanks prints the \ high score at column 35 on row 1 BL PrintScoreInBothBanks \ Print the high score in R0 at column 35 on \ row 1, at the right end of the score bar LDR R0, initialScore \ Initialise currentScore to the score that STR R0, [R11, #currentScore] \ we start each game with, which is set in \ initialScore \ We now initialise more game variables LDR R0, initialFuelLevel \ Initialise fuelLevel to the fuel level STR R0, [R11, #fuelLevel] \ that we start each game with, which is set \ in initialFuelLevel MOV R0, #&30000 \ Initialise gravity to &30000 STR R0, [R11, #gravity] MOV R0, #3 \ Initialise the number of lives to 3 STR R0, [R11, #remainingLives]Name: StartNewGame [Show more] Type: Subroutine Category: Main loop Summary: Start a brand new game with a full set of lives and a newly generated set of objectsContext: See this subroutine in context in the source code References: This subroutine is called as follows: * GameOver calls StartNewGame
[X]
Subroutine PrintScoreInBothBanks (category: Score bar)
Print a number at a specified text column in the score bar
[X]
Configuration variable currentScore = &124
Our current score, which is displayed at the left end of the score bar
[X]
Configuration variable fuelLevel = &128
The player's fuel level
[X]
Configuration variable gravity = &12C
The current setting of gravity (which changes on higher levels)
[X]
Configuration variable highScore = &138
The high score, which is displayed at the right end of the score bar
[X]
Variable initialFuelLevel (category: Score bar)
The fuel level at the start of each new game
[X]
Variable initialScore (category: Score bar)
The score at the start of each game
[X]
Configuration variable remainingLives = &134
The number of remaining lives, which is displayed towards the right end of the score bar, just before the high score