Prev: F535 Up: Map Next: F5E3
F56E: Handler: New High Score
Compare 1UP_Score_1 with 2UP_Score_1 and start name entry for the higher score.
NewHighScore F56E LD DE,$5E5F DE=1UP_Score_1.
F571 LD HL,$5E62 HL=2UP_Score_1.
Compare the first bytes of the 1UP and 2UP scores.
F574 LD A,(DE) Fetch the 1UP score byte.
F575 CP (HL) Compare it with the 2UP score byte.
F576 JP C,NewHighScore_Rank2UP Jump to NewHighScore_Rank2UP if 2UP is higher.
F579 JR Z,NewHighScore_SecondByte Jump to NewHighScore_SecondByte if the bytes match.
F57B JR NewHighScore_Rank1UP Jump to NewHighScore_Rank1UP.
Compare the second bytes when the first bytes match.
NewHighScore_SecondByte F57D INC DE Advance the 1UP pointer.
F57E LD A,(DE) Fetch the next 1UP byte.
F57F INC HL Advance the 2UP pointer.
F580 CP (HL) Compare it with the 2UP byte.
F581 JP C,NewHighScore_Rank2UP Jump to NewHighScore_Rank2UP if 2UP is higher.
F584 JR Z,NewHighScore_ThirdByte Jump to NewHighScore_ThirdByte if the bytes match.
F586 JR NewHighScore_Rank1UP Jump to NewHighScore_Rank1UP.
Compare the third bytes when the second bytes match.
NewHighScore_ThirdByte F588 INC DE Advance the 1UP pointer.
F589 INC HL Advance the 2UP pointer.
F58A LD A,(DE) Fetch the last 1UP byte.
F58B CP (HL) Compare it with the 2UP byte.
F58C JP C,NewHighScore_Rank2UP Jump to NewHighScore_Rank2UP if 2UP is higher.
Rank 1UP first.
NewHighScore_Rank1UP F58F LD A,$02 Write 02 to HighScore_OtherPlayer.
F591 LD ($5E72),A
F594 LD A,$01 Write 01 to HighScore_Player.
F596 LD ($5E71),A
Clear the pending player if this is a one-player game.
F599 LD A,($5E00) Fetch GameOptions.
F59C BIT 0,A Jump to NewHighScore_Compare1UP if bit 0 is set.
F59E JP NZ,NewHighScore_Compare1UP
F5A1 XOR A Write 00 to HighScore_OtherPlayer.
F5A2 LD ($5E72),A
Test the 1UP score against the table and start name entry if it is high enough.
NewHighScore_Compare1UP F5A5 LD DE,$5E5F DE=1UP_Score_1.
F5A8 XOR A Write 00 to HighScore_PlayerCopy.
F5A9 LD ($5E74),A
F5AC CALL CompareHighScores Call CompareHighScores.
F5AF LD A,B Jump to ReturnToRestart if the score is not high enough.
F5B0 AND A
F5B1 JP Z,ReturnToRestart
F5B4 LD A,$01 Write 01 to HighScore_Done.
F5B6 LD ($5E73),A
F5B9 CALL PrepareNameEntry Call PrepareNameEntry.
F5BC JP HallOfFame_Input Jump to HallOfFame_Input.
Rank 2UP first.
NewHighScore_Rank2UP F5BF LD C,$4A C=4A.
Test the 2UP score against the table.
F5C1 LD DE,$5E62 DE=2UP_Score_1.
F5C4 XOR A Write 00 to HighScore_PlayerCopy.
F5C5 LD ($5E74),A
F5C8 CALL CompareHighScores Call CompareHighScores.
F5CB LD A,B Jump to ReturnToRestart if the score is not high enough.
F5CC AND A
F5CD JP Z,ReturnToRestart
Make 2UP the player entering a name with 1UP pending, then start name entry.
F5D0 LD A,$02 Write 02 to HighScore_Player.
F5D2 LD ($5E71),A
F5D5 LD A,$01 Write 01 to HighScore_OtherPlayer.
F5D7 LD ($5E72),A
F5DA LD ($5E73),A Write it to HighScore_Done.
F5DD CALL PrepareNameEntry Call PrepareNameEntry.
F5E0 JP HallOfFame_Input Jump to HallOfFame_Input.
Prev: F535 Up: Map Next: F5E3