![]() |
Routines |
| Prev: 46473 | Up: Map | Next: 46540 |
|
Adds points to the score of the active player. The scores are held as three bytes, each with two BCD digits. The new score is then printed by Score_1UP.
|
||||||||||||
|
Check the active player.
|
||||||||||||
| AddPointsToScore | 46505 | LD A,(38558) | Jump to AddPointsToScore_2UP if the active player is 2UP. | |||||||||
| 46508 | AND A | |||||||||||
| 46509 | JR NZ,AddPointsToScore_2UP | |||||||||||
|
Set the score address for 1UP.
|
||||||||||||
| 46511 | LD HL,38554 | Point HL at the score of 1UP at 1UP_Score_3. | ||||||||||
| 46514 | JR AddPointsToScore_Start | Jump to AddPointsToScore_Start. | ||||||||||
|
Set the score address for 2UP.
|
||||||||||||
| AddPointsToScore_2UP | 46516 | LD HL,38557 | Point HL at the score of 2UP at 2UP_Score_3. | |||||||||
|
Process adding the points to the appropriate score.
|
||||||||||||
| AddPointsToScore_Start | 46519 | LD A,(HL) | Fetch the lowest pair of digits of the score. | |||||||||
| 46520 | ADD A,C | Add the low byte of the points to the digits (in BCD). | ||||||||||
| 46521 | DAA | |||||||||||
| 46522 | LD (HL),A | Store the new lowest pair of digits. | ||||||||||
| 46523 | DEC HL | Move onto the middle pair of digits. | ||||||||||
| 46524 | LD A,(HL) | Fetch the middle pair of digits of the score. | ||||||||||
| 46525 | ADC A,B | Add the high byte of the points to the digits, plus the carry (in BCD). | ||||||||||
| 46526 | DAA | |||||||||||
| 46527 | LD (HL),A | Store the new middle pair of digits. | ||||||||||
| 46528 | DEC HL | Move onto the highest pair of digits. | ||||||||||
| 46529 | LD A,(HL) | Fetch the highest pair of digits of the score. | ||||||||||
| 46530 | ADC A,0 | Add the carry to the digits (in BCD). | ||||||||||
| 46532 | DAA | |||||||||||
| 46533 | LD (HL),A | Store the new highest pair of digits. | ||||||||||
|
Check the active player.
|
||||||||||||
| 46534 | LD A,(38558) | Jump to Score_2UP if the active player is 2UP. | ||||||||||
| 46537 | AND A | |||||||||||
| 46538 | JR NZ,Score_2UP | |||||||||||
|
View the equivalent code in;
|
||||||||||||
| Prev: 46473 | Up: Map | Next: 46540 |