Prev: 6031 Up: Map Next: 605B
6046: 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 6046 LD HL,$5E4E Point HL at the units and tens of the score (Score_3).
6049 LD A,(HL) Fetch the units and tens of the score.
604A ADD A,C Add the units and tens of the points to it, using BCD.
604B DAA
604C LD (HL),A Write the new units and tens back to the score.
604D DEC HL Move on to the hundreds and thousands of the score.
604E LD A,(HL) Fetch the hundreds and thousands of the score.
604F ADC A,B Add the hundreds and thousands of the points, plus any carry, using BCD.
6050 DAA
6051 LD (HL),A Write the new hundreds and thousands back to the score.
6052 DEC HL Move on to the ten thousands and hundred thousands of the score.
6053 LD A,(HL) Fetch the ten thousands and hundred thousands of the score.
6054 ADC A,$00 Add any carry from the hundreds and thousands to it, using BCD.
6056 DAA
6057 LD (HL),A Write the new ten thousands and hundred thousands back to the score.
6058 JP Score_1UP Jump to Score_1UP to print the new score.
Prev: 6031 Up: Map Next: 605B