Prev: 24625 Up: Map Next: 24667
24646: Add Points To Score
Used by the routines at HandlerCup, UpdatePlayerCar and PlaceObject.
Adds a number of points to the score, using BCD arithmetic, and then prints the new score. The score is held as three BCD bytes from Score_1, the least significant byte being the last.
Input
B Points to add (hundreds and thousands, as BCD)
C Points to add (units and tens, as BCD)
AddPointsToScore 24646 LD HL,24142 Point HL at the units and tens of the score (Score_3).
24649 LD A,(HL) Fetch the units and tens of the score.
24650 ADD A,C Add the units and tens of the points to it, using BCD.
24651 DAA
24652 LD (HL),A Write the new units and tens back to the score.
24653 DEC HL Move on to the hundreds and thousands of the score.
24654 LD A,(HL) Fetch the hundreds and thousands of the score.
24655 ADC A,B Add the hundreds and thousands of the points, plus any carry, using BCD.
24656 DAA
24657 LD (HL),A Write the new hundreds and thousands back to the score.
24658 DEC HL Move on to the ten thousands and hundred thousands of the score.
24659 LD A,(HL) Fetch the ten thousands and hundred thousands of the score.
24660 ADC A,0 Add any carry from the hundreds and thousands to it, using BCD.
24662 DAA
24663 LD (HL),A Write the new ten thousands and hundred thousands back to the score.
24664 JP Score_1UP Jump to Score_1UP to print the new score.
Prev: 24625 Up: Map Next: 24667