Prev: 24646 Up: Map Next: 24701
24667: Check High Score
Used by the routine at GameOver.
CheckHighScore 24667 LD DE,24136 DE=24136 noting due to the INC below this is HighScore_1 - 1.
24670 LD HL,24139 HL=24139 noting due to the INC below this is Score_1 - 1.
24673 LD B,3 B=3 (scores are held in three digits).
CheckHighScore_Loop 24675 INC HL Increment HL by one.
24676 INC DE Increment DE by one.
24677 LD A,(DE) Check DE against HL.
24678 CP (HL)
24679 JR C,NewHighScore If the current score digit is higher than the same digit of the high score then jump to NewHighScore.
24681 JR Z,CheckHighScore_Skip If both the same digits of the current score and high score are the same number jump straight onto CheckHighScore_Skip.
24683 RET NC Return if the current score digit is less than the same high score digit.
CheckHighScore_Skip 24684 DJNZ CheckHighScore_Loop Decrease counter by one and loop back to CheckHighScore_Loop until counter is zero.
A new High Score has been made, so update HighScore.
NewHighScore 24686 LD B,3 B=3 (scores are held in three digits).
24688 LD HL,24140 HL=Score_1.
24691 LD DE,24137 DE=HighScore_1.
NewHighScore_CopyLoop 24694 LD A,(HL) Copy the byte from HL to DE.
24695 LD (DE),A
24696 INC HL Increment HL by one.
24697 INC DE Increment DE by one.
24698 DJNZ NewHighScore_CopyLoop Decrease counter by one and loop back to NewHighScore_CopyLoop until counter is zero.
24700 RET Return.
View the equivalent code in;
Prev: 24646 Up: Map Next: 24701