![]() |
Routines |
| Prev: 73CB | Up: Map | Next: 7415 |
|
Used by the routine at GameOver_ControllerRestart.
Finds which of the 1UP score and the 2UP score is higher, and if it is higher than the high score (High_Score) then it becomes the new high score.
|
||||
| CheckHighScore | 73D3 | LD HL,($5F0E) | Fetch the first two bytes of the 1UP score. | |
| 73D6 | LD DE,($5F11) | Fetch the first two bytes of the 2UP score. | ||
| 73DA | LD A,L | Swap the bytes of HL and DE, so the most significant byte of each is first. | ||
| 73DB | LD L,H | |||
| 73DC | LD H,A | |||
| 73DD | LD A,E | |||
| 73DE | LD E,D | |||
| 73DF | LD D,A | |||
| 73E0 | AND A | Subtract the 2UP score from the 1UP score. | ||
| 73E1 | SBC HL,DE | |||
| 73E3 | JR C,CheckHighScore_2UP | Jump to CheckHighScore_2UP if the 2UP score is higher. | ||
| 73E5 | JR NZ,CheckHighScore_1UP | Jump to CheckHighScore_1UP if the 1UP score is higher. | ||
| 73E7 | LD A,($5F10) | Compare 1UP_Score_3 against 2UP_Score_3. | ||
| 73EA | LD E,A | |||
| 73EB | LD A,($5F13) | |||
| 73EE | CP E | |||
| 73EF | JR C,CheckHighScore_1UP | Jump to CheckHighScore_1UP if the 1UP score is higher. | ||
| CheckHighScore_2UP | 73F1 | LD HL,$5F11 | Point HL at the 2UP score. | |
| CheckHighScore_Compare | 73F4 | PUSH HL | Stash the address of the score on the stack. | |
| 73F5 | LD DE,$5F09 | Point DE at High_Score. | ||
| 73F8 | LD B,$03 | Set the byte counter to 03 (scores are held in three bytes). | ||
| CheckHighScore_Loop | 73FA | LD A,(DE) | Fetch a byte of the high score. | |
| 73FB | CP (HL) | Compare with the same byte of the score. | ||
| 73FC | JR C,CheckHighScore_New | Jump to CheckHighScore_New if the high score is lower. | ||
| 73FE | JR NZ,CheckHighScore_Finish | Jump to CheckHighScore_Finish if the high score is higher. | ||
| 7400 | INC HL | Move on to the next byte of the score. | ||
| 7401 | INC DE | Move on to the next byte of the high score. | ||
| 7402 | DJNZ CheckHighScore_Loop | Decrease the byte counter by one and loop back to CheckHighScore_Loop until all of the bytes have been compared. | ||
| CheckHighScore_Finish | 7404 | POP HL | Restore the address of the score from the stack. | |
| 7405 | RET | Return. | ||
|
The high score has been beaten.
|
||||
| CheckHighScore_New | 7406 | POP HL | Restore the address of the score from the stack. | |
| 7407 | LD DE,$5F09 | Point DE at High_Score. | ||
| 740A | LD BC,$0003 | Set the number of bytes to copy to 03. | ||
| 740D | LDIR | Copy the score to the high score. | ||
| 740F | RET | Return. | ||
| CheckHighScore_1UP | 7410 | LD HL,$5F0E | Point HL at the 1UP score. | |
| 7413 | JR CheckHighScore_Compare | Jump to CheckHighScore_Compare. | ||
| Prev: 73CB | Up: Map | Next: 7415 |