Prev: 29651 Up: Map Next: 29752
29717: Add Points To Score
Used by the routines at HandleMonster, NextLevel, CatchHitActor and RemoveFallenActor.
Adds points to the score of the active player, and then prints that score.
Before After 592 points
add-points-before add-points-after
Input
BC Points to add to score (in BCD)
Check the active player.
AddPointsToScore 29717 LD A,(24353) If Flag_ActivePlayer is not zero, jump to AddPointsToScore_2UP.
29720 AND A
29721 JR NZ,AddPointsToScore_2UP
Set the score address for 1UP.
29723 LD HL,24336 Point HL at the last byte of the 1UP score.
29726 JR AddPointsToScore_Start Jump to AddPointsToScore_Start.
Set the score address for 2UP.
AddPointsToScore_2UP 29728 LD HL,24339 Point HL at the last byte of the 2UP score.
Process adding the points to the appropriate score.
AddPointsToScore_Start 29731 LD A,(HL) Fetch the last byte of the score.
29732 ADD A,C Add the points in C (in BCD).
29733 DAA
29734 LD (HL),A Update the last byte of the score.
29735 DEC HL Move on to the middle byte of the score.
29736 LD A,(HL) Fetch the middle byte of the score.
29737 ADC A,B Add the points in B (in BCD), with the carry.
29738 DAA
29739 LD (HL),A Update the middle byte of the score.
29740 DEC HL Move on to the first byte of the score.
29741 LD A,(HL) Fetch the first byte of the score.
29742 ADC A,0 Add the carry (in BCD).
29744 DAA
29745 LD (HL),A Update the first byte of the score.
Check the active player.
29746 LD A,(24353) If Flag_ActivePlayer is not zero, jump to Score_2UP.
29749 AND A
29750 JR NZ,Score_2UP
Prev: 29651 Up: Map Next: 29752