![]() |
Routines |
| Prev: B589 | Up: Map | Next: B5CC |
|
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 | B5A9 | LD A,($969E) | Jump to AddPointsToScore_2UP if the active player is 2UP. | |||||||||
| B5AC | AND A | |||||||||||
| B5AD | JR NZ,AddPointsToScore_2UP | |||||||||||
|
Set the score address for 1UP.
|
||||||||||||
| B5AF | LD HL,$969A | Point HL at the score of 1UP at 1UP_Score_3. | ||||||||||
| B5B2 | JR AddPointsToScore_Start | Jump to AddPointsToScore_Start. | ||||||||||
|
Set the score address for 2UP.
|
||||||||||||
| AddPointsToScore_2UP | B5B4 | LD HL,$969D | Point HL at the score of 2UP at 2UP_Score_3. | |||||||||
|
Process adding the points to the appropriate score.
|
||||||||||||
| AddPointsToScore_Start | B5B7 | LD A,(HL) | Fetch the lowest pair of digits of the score. | |||||||||
| B5B8 | ADD A,C | Add the low byte of the points to the digits (in BCD). | ||||||||||
| B5B9 | DAA | |||||||||||
| B5BA | LD (HL),A | Store the new lowest pair of digits. | ||||||||||
| B5BB | DEC HL | Move onto the middle pair of digits. | ||||||||||
| B5BC | LD A,(HL) | Fetch the middle pair of digits of the score. | ||||||||||
| B5BD | ADC A,B | Add the high byte of the points to the digits, plus the carry (in BCD). | ||||||||||
| B5BE | DAA | |||||||||||
| B5BF | LD (HL),A | Store the new middle pair of digits. | ||||||||||
| B5C0 | DEC HL | Move onto the highest pair of digits. | ||||||||||
| B5C1 | LD A,(HL) | Fetch the highest pair of digits of the score. | ||||||||||
| B5C2 | ADC A,$00 | Add the carry to the digits (in BCD). | ||||||||||
| B5C4 | DAA | |||||||||||
| B5C5 | LD (HL),A | Store the new highest pair of digits. | ||||||||||
|
Check the active player.
|
||||||||||||
| B5C6 | LD A,($969E) | Jump to Score_2UP if the active player is 2UP. | ||||||||||
| B5C9 | AND A | |||||||||||
| B5CA | JR NZ,Score_2UP | |||||||||||
|
View the equivalent code in;
|
||||||||||||
| Prev: B589 | Up: Map | Next: B5CC |