Prev: B56B Up: Map Next: B585
B573: Add Points To Score
Used by the routines at MoveProgramPacket, CheckShotHit and InstallProgram.
Adds points to the score of the player and then prints the new score. The score is stored as six decimal digits in three bytes.
Before After
add-points-before add-points-after
Input
B Points to add (the hundreds and thousands digits)
C Points to add (the units and tens digits)
AddPointsToScore B573 LD HL,$961D Point HL at the least significant byte of the score.
B576 LD A,(HL) Add the units and tens.
B577 ADD A,C
B578 DAA
B579 LD (HL),A Store the result.
B57A DEC HL Move on to the middle byte of the score.
B57B LD A,(HL) Add the hundreds and thousands, plus the carry.
B57C ADC A,B
B57D DAA
B57E LD (HL),A Store the result.
B57F DEC HL Move on to the most significant byte of the score.
B580 LD A,(HL) Add the carry.
B581 ADC A,$00
B583 DAA
B584 LD (HL),A Store the result.
Prev: B56B Up: Map Next: B585