Prev: 41349 Up: Map Next: 41390
41372: Add Points To Score
Used by the routines at PopCreature and HandlerFrankenstein.
Adds some points to the score, which is held as three bytes of BCD starting at Score_1 (the most significant byte is first). It then carries on to print the score.
Before After
add-points-before add-points-after
Input
BC The points to add to the score (as BCD)
AddPointsToScore 41372 LD HL,24108 Point HL at the last byte of the score at Score_3.
41375 LD A,(HL) Fetch the last byte of the score.
41376 ADD A,C Add C.
41377 DAA Convert the result to BCD.
41378 LD (HL),A Update the last byte of the score.
41379 DEC HL Move on to the middle byte of the score.
41380 LD A,(HL) Fetch the middle byte of the score.
41381 ADC A,B Add B, with the carry.
41382 DAA Convert the result to BCD.
41383 LD (HL),A Update the middle byte of the score.
41384 DEC HL Move on to the first byte of the score.
41385 LD A,(HL) Fetch the first byte of the score.
41386 ADC A,0 Add 0 (i.e. just the carry flag).
41388 DAA Convert the result to BCD.
41389 LD (HL),A Update the first byte of the score.
Prev: 41349 Up: Map Next: 41390