![]() |
Routines |
| Prev: 8C0D | Up: Map | Next: 9690 |
|
Adds points to the score of the current player, which is kept as six digits in three bytes of binary coded decimal, and awards an extra life each time the score passes a multiple of 5000 points (see D619). It then prints the new score.
|
||||||||||||
| AddScore | 9662 | LD A,($DEFB) | Fetch the highest two digits of the score and keep them in D. | |||||||||
| 9665 | LD D,A | |||||||||||
| 9666 | LD A,($DEFA) | Fetch the middle two digits of the score. | ||||||||||
| 9669 | LD E,$00 | Clear the flag in E, which will show whether the score was already past the 5000 point mark. | ||||||||||
| 966B | CP $50 | Jump to AddScore_Add if they are below 50. | ||||||||||
| 966D | JR C,AddScore_Add | |||||||||||
| 966F | INC E | Set the flag. | ||||||||||
| AddScore_Add | 9670 | LD HL,$DEF9 | Point HL at the score. | |||||||||
| 9673 | LD A,C | Fetch the lowest two digits of the points. | ||||||||||
| 9674 | ADD A,(HL) | Add the lowest two digits of the score. | ||||||||||
| 9675 | DAA | Adjust the result to binary coded decimal. | ||||||||||
| 9676 | LD (HL),A | Store the new lowest two digits. | ||||||||||
| 9677 | INC HL | Move onto the middle two digits. | ||||||||||
| 9678 | LD A,B | Fetch the middle two digits of the points. | ||||||||||
| 9679 | ADC A,(HL) | Add the middle two digits of the score, with the carry. | ||||||||||
| 967A | DAA | Adjust the result to binary coded decimal. | ||||||||||
| 967B | LD (HL),A | Store the new middle two digits. | ||||||||||
| 967C | INC HL | Move onto the highest two digits. | ||||||||||
| 967D | LD A,$00 | A is 00. | ||||||||||
| 967F | ADC A,(HL) | Add the highest two digits of the score, with the carry. | ||||||||||
| 9680 | DAA | Adjust the result to binary coded decimal. | ||||||||||
| 9681 | LD (HL),A | Store the new highest two digits. | ||||||||||
| 9682 | LD A,E | Fetch the flag. | ||||||||||
| 9683 | AND A | Test it. | ||||||||||
| 9684 | JR NZ,PrintScore | Jump to PrintScore if the score was already past the 5000 point mark. | ||||||||||
| 9686 | LD A,($DEFA) | Fetch the middle two digits of the score. | ||||||||||
| 9689 | CP $50 | Compare them with 50. | ||||||||||
| 968B | CALL NC,CollectItem_ExtraLife | Call D619 to award an extra life if the score has now passed the 5000 mark. | ||||||||||
| 968E | JR PrintScore_Digits | Jump to PrintScore_Digits to print the score. | ||||||||||
|
View the equivalent code in;
|
||||||||||||
| Prev: 8C0D | Up: Map | Next: 9690 |