Skip to navigation

Aviator on the BBC Micro

Scoring: UpdateHighScore

Name: UpdateHighScore [Show more] Type: Subroutine Category: Scoring Summary: If this is a high score, update the high score
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * TerminateGame calls UpdateHighScore
.UpdateHighScore LDA scoreHi \ If scoreHi < highScoreHi then we have not achieved a CMP highScoreHi \ high score, so jump to high3 to return from the BCC high3 \ subroutine BNE high1 \ If the high byte of the score and high score are not \ equal, then we know scoreHi > highScoreHi, so jump to \ high1 to update the high score LDA scoreLo \ If we get here then scoreHi = highScoreHi, so now we CMP highScoreLo \ check the low bytes. If ScoreHLo < highScoreLo then we BCC high3 \ have not achieved a high score, so jump to high3 to \ return from the subroutine .high1 LDA scoreLo \ (scoreHi scoreLo) > (highScoreHi highScoreLo), so this STA highScoreLo \ is a new high score, so update the 16-bit high score LDA scoreHi \ to the new score STA highScoreHi .high3 RTS \ Return from the subroutine