Prev: A402 Up: Map Next: A685
A647: New High Score?
Used by the routines at Main_Game and Start_2UP_Game.
Check if either player has broken the high score.
Check_HighScore A647 LD HL,$B035 HL=high score.
A64A LD DE,$B02F DE=1UP score
If this is not a two player game then we skip forward to Check_HighScore_1UP to only test for the 1UP score.
A64D LD A,($9C2C) Check Num_Players; is this a 2 player game?
A650 CP $02
A652 JR NZ,Check_HighScore_1UP If not, jump to Check_HighScore_1UP.
A6B6 mirrors Num_Players here. todo: why?
A654 LD ($A6B6),A Store 02 at A6B6.
Check 2UP score.
A657 LD HL,$B032 HL=Score_P2 and call Is_HighScore.
A65A CALL Is_HighScore
A65D JR NC,Check_HighScore_Changes Jump to Check_HighScore_Changes if this is not a new high score.
Overwrite the high score with the 2UP score.
A65F LD BC,$0003 Copy the 2UP score over the current Hi_Score.
A662 LDDR
A664 LD DE,$B02F DE=2UP score
A667 JR Check_HighScore_Restore Jump to Check_HighScore_Restore.
Checks if all three digits changed. todo: why?
Check_HighScore_Changes A669 LD A,($A6B7) Check A6B7; are there three digit changes?
A66C CP $03
A66E LD A,$01 Store 01 at A6B6 (skips forward to HighScore_Write_A6B6).
A670 JR NZ,HighScore_Write_A6B6
Else reset A6B6.
A672 XOR A Write 00 to A6B6.
HighScore_Write_A6B6 A673 LD ($A6B6),A
Resets HL with B038 so the 1UP score can also be tested.
Check_HighScore_Restore A676 LD HL,$B038 HL=B038.
Check_HighScore_1UP A679 CALL Is_HighScore Call Is_HighScore.
A67C RET C Return if this is not a new high score.
Overwrite the high score with the 1UP score.
A67D PUSH HL Stash the high score memory address temporarily.
A67E EX DE,HL Overwrite the high score.
A67F LD BC,$0003
A682 LDDR
A684 POP HL Restore the high score memory address to HL.
Prev: A402 Up: Map Next: A685