Prev: 47908 Up: Map Next: 47931
47913: Add To Score
Used by the routine at ScoreForCreature.
Adds an amount to the score, which is held as three bytes of binary coded decimal, with the most significant byte first, and then draws the new score.
Before After AddToScore and UpdateScreen
add-to-score-before add-to-score-after
Input
BC Amount to add, as four decimal digits
AddToScore 47913 LD HL,42822 Start at the last byte of the score, Score.
47916 LD A,(HL) Add the last two digits of the amount to the last two digits of the score.
47917 ADD A,C
47918 DAA
47919 LD (HL),A
47920 DEC HL Move to the next byte of the score.
47921 LD A,(HL) Add the next two digits of the amount, and the carry.
47922 ADC A,B
47923 DAA
47924 LD (HL),A
47925 DEC HL Move to the first byte of the score.
47926 LD A,(HL) Add the carry to the first two digits of the score.
47927 ADC A,0
47929 DAA
47930 LD (HL),A
Prev: 47908 Up: Map Next: 47931