Prev: 6046 Up: Map Next: 607D
605B: Check High Score
Used by the routine at GameOver.
CheckHighScore 605B LD DE,$5E48 DE=5E48 noting due to the INC below this is HighScore_1 - 01.
605E LD HL,$5E4B HL=5E4B noting due to the INC below this is Score_1 - 01.
6061 LD B,$03 B=03 (scores are held in three digits).
CheckHighScore_Loop 6063 INC HL Increment HL by one.
6064 INC DE Increment DE by one.
6065 LD A,(DE) Check DE against HL.
6066 CP (HL)
6067 JR C,NewHighScore If the current score digit is higher than the same digit of the high score then jump to NewHighScore.
6069 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.
606B RET NC Return if the current score digit is less than the same high score digit.
CheckHighScore_Skip 606C 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 606E LD B,$03 B=03 (scores are held in three digits).
6070 LD HL,$5E4C HL=Score_1.
6073 LD DE,$5E49 DE=HighScore_1.
NewHighScore_CopyLoop 6076 LD A,(HL) Copy the byte from HL to DE.
6077 LD (DE),A
6078 INC HL Increment HL by one.
6079 INC DE Increment DE by one.
607A DJNZ NewHighScore_CopyLoop Decrease counter by one and loop back to NewHighScore_CopyLoop until counter is zero.
607C RET Return.
View the equivalent code in;
Prev: 6046 Up: Map Next: 607D