![]() |
Routines |
| Prev: 46763 | Up: Map | Next: 46789 |
|
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 | 46770 | PUSH BC | Stash BC, DE and HL on the stack. | |||||||||||
| 46771 | PUSH DE | |||||||||||||
| 46772 | PUSH HL | |||||||||||||
|
Scores are held in three bytes.
|
||||||||||||||
| 46773 | LD B,3 | Set the number of bytes of the score in B to 3. | ||||||||||||
| NewHighScore_Compare_Loop | 46775 | LD A,(DE) | Fetch a pair of digits of the first score. | |||||||||||
| 46776 | CP (HL) | Compare it with the pair of digits of the second score. | ||||||||||||
| 46777 | JR C,NewHighScore_Compare_Return | Jump to NewHighScore_Compare_Return if the first score is lower. | ||||||||||||
| 46779 | JR NZ,NewHighScore_Compare_Return | Jump to NewHighScore_Compare_Return if the first score is higher. | ||||||||||||
| 46781 | INC HL | Move onto the next pair of digits of both scores. | ||||||||||||
| 46782 | INC DE | |||||||||||||
| 46783 | 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 | 46785 | POP HL | Restore HL, DE and BC from the stack. | |||||||||||
| 46786 | POP DE | |||||||||||||
| 46787 | POP BC | |||||||||||||
| 46788 | RET | Return. | ||||||||||||
|
View the equivalent code in;
|
||||||||||||||
| Prev: 46763 | Up: Map | Next: 46789 |