Prev: 62773 Up: Map Next: 62947
62830: Handler: New High Score
Compare 1UP_Score_1 with 2UP_Score_1 and start name entry for the higher score.
NewHighScore 62830 LD DE,24159 DE=1UP_Score_1.
62833 LD HL,24162 HL=2UP_Score_1.
Compare the first bytes of the 1UP and 2UP scores.
62836 LD A,(DE) Fetch the 1UP score byte.
62837 CP (HL) Compare it with the 2UP score byte.
62838 JP C,NewHighScore_Rank2UP Jump to NewHighScore_Rank2UP if 2UP is higher.
62841 JR Z,NewHighScore_SecondByte Jump to NewHighScore_SecondByte if the bytes match.
62843 JR NewHighScore_Rank1UP Jump to NewHighScore_Rank1UP.
Compare the second bytes when the first bytes match.
NewHighScore_SecondByte 62845 INC DE Advance the 1UP pointer.
62846 LD A,(DE) Fetch the next 1UP byte.
62847 INC HL Advance the 2UP pointer.
62848 CP (HL) Compare it with the 2UP byte.
62849 JP C,NewHighScore_Rank2UP Jump to NewHighScore_Rank2UP if 2UP is higher.
62852 JR Z,NewHighScore_ThirdByte Jump to NewHighScore_ThirdByte if the bytes match.
62854 JR NewHighScore_Rank1UP Jump to NewHighScore_Rank1UP.
Compare the third bytes when the second bytes match.
NewHighScore_ThirdByte 62856 INC DE Advance the 1UP pointer.
62857 INC HL Advance the 2UP pointer.
62858 LD A,(DE) Fetch the last 1UP byte.
62859 CP (HL) Compare it with the 2UP byte.
62860 JP C,NewHighScore_Rank2UP Jump to NewHighScore_Rank2UP if 2UP is higher.
Rank 1UP first.
NewHighScore_Rank1UP 62863 LD A,2 Write 2 to HighScore_OtherPlayer.
62865 LD (24178),A
62868 LD A,1 Write 1 to HighScore_Player.
62870 LD (24177),A
Clear the pending player if this is a one-player game.
62873 LD A,(24064) Fetch GameOptions.
62876 BIT 0,A Jump to NewHighScore_Compare1UP if bit 0 is set.
62878 JP NZ,NewHighScore_Compare1UP
62881 XOR A Write 0 to HighScore_OtherPlayer.
62882 LD (24178),A
Test the 1UP score against the table and start name entry if it is high enough.
NewHighScore_Compare1UP 62885 LD DE,24159 DE=1UP_Score_1.
62888 XOR A Write 0 to HighScore_PlayerCopy.
62889 LD (24180),A
62892 CALL CompareHighScores Call CompareHighScores.
62895 LD A,B Jump to ReturnToRestart if the score is not high enough.
62896 AND A
62897 JP Z,ReturnToRestart
62900 LD A,1 Write 1 to HighScore_Done.
62902 LD (24179),A
62905 CALL PrepareNameEntry Call PrepareNameEntry.
62908 JP HallOfFame_Input Jump to HallOfFame_Input.
Rank 2UP first.
NewHighScore_Rank2UP 62911 LD C,74 C=74.
Test the 2UP score against the table.
62913 LD DE,24162 DE=2UP_Score_1.
62916 XOR A Write 0 to HighScore_PlayerCopy.
62917 LD (24180),A
62920 CALL CompareHighScores Call CompareHighScores.
62923 LD A,B Jump to ReturnToRestart if the score is not high enough.
62924 AND A
62925 JP Z,ReturnToRestart
Make 2UP the player entering a name with 1UP pending, then start name entry.
62928 LD A,2 Write 2 to HighScore_Player.
62930 LD (24177),A
62933 LD A,1 Write 1 to HighScore_OtherPlayer.
62935 LD (24178),A
62938 LD (24179),A Write it to HighScore_Done.
62941 CALL PrepareNameEntry Call PrepareNameEntry.
62944 JP HallOfFame_Input Jump to HallOfFame_Input.
Prev: 62773 Up: Map Next: 62947