![]() |
Routines |
| Prev: B6AB | Up: Map | Next: B6C5 |
|
Used by the routines at NewHighScore and NewHighScore_Enter.
Compares the scores pointed to by DE and HL. They are held as three bytes, with the most significant digits first.
|
||||||||||||||
| NewHighScore_Compare | B6B2 | PUSH BC | Stash BC, DE and HL on the stack. | |||||||||||
| B6B3 | PUSH DE | |||||||||||||
| B6B4 | PUSH HL | |||||||||||||
|
Scores are held in three bytes.
|
||||||||||||||
| B6B5 | LD B,$03 | Set the number of bytes of the score in B to 03. | ||||||||||||
| NewHighScore_Compare_Loop | B6B7 | LD A,(DE) | Fetch a pair of digits of the first score. | |||||||||||
| B6B8 | CP (HL) | Compare it with the pair of digits of the second score. | ||||||||||||
| B6B9 | JR C,NewHighScore_Compare_Return | Jump to NewHighScore_Compare_Return if the first score is lower. | ||||||||||||
| B6BB | JR NZ,NewHighScore_Compare_Return | Jump to NewHighScore_Compare_Return if the first score is higher. | ||||||||||||
| B6BD | INC HL | Move onto the next pair of digits of both scores. | ||||||||||||
| B6BE | INC DE | |||||||||||||
| B6BF | DJNZ NewHighScore_Compare_Loop | Decrease the digit pair counter by one and loop back to NewHighScore_Compare_Loop until all three pairs of digits have been compared. | ||||||||||||
| NewHighScore_Compare_Return | B6C1 | POP HL | Restore HL, DE and BC from the stack. | |||||||||||
| B6C2 | POP DE | |||||||||||||
| B6C3 | POP BC | |||||||||||||
| B6C4 | RET | Return. | ||||||||||||
|
View the equivalent code in;
|
||||||||||||||
| Prev: B6AB | Up: Map | Next: B6C5 |