Prev: 46443 Up: Map Next: 46469
46451: 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 46451 LD HL,38429 Point HL at the least significant byte of the score.
46454 LD A,(HL) Add the units and tens.
46455 ADD A,C
46456 DAA
46457 LD (HL),A Store the result.
46458 DEC HL Move on to the middle byte of the score.
46459 LD A,(HL) Add the hundreds and thousands, plus the carry.
46460 ADC A,B
46461 DAA
46462 LD (HL),A Store the result.
46463 DEC HL Move on to the most significant byte of the score.
46464 LD A,(HL) Add the carry.
46465 ADC A,0
46467 DAA
46468 LD (HL),A Store the result.
Prev: 46443 Up: Map Next: 46469