Prev: 894F Up: Map Next: 89BF
899C: Add Points To Score
Add BC to the active player's BCD score, then print that score.
Input
BC Points to add to score
Check the active player.
AddPointsToScore 899C LD A,($5E65) If Flag_ActivePlayer is not zero, jump to AddPointsToScore_2UP.
899F AND A
89A0 JR NZ,AddPointsToScore_2UP
Set the score address for 1UP.
89A2 LD HL,$5E61 HL=1UP_Score_3.
89A5 JR AddPointsToScore_Start Jump to AddPointsToScore_Start.
Set the score address for 2UP.
AddPointsToScore_2UP 89A7 LD HL,$5E64 HL=2UP_Score_3.
Process adding the points to the appropriate score.
AddPointsToScore_Start 89AA LD A,(HL) A=score byte #3.
89AB ADD A,C Add C to score byte #3 with BCD conversion.
89AC DAA
89AD LD (HL),A Update score byte #3.
89AE DEC HL Move onto the next score byte.
89AF LD A,(HL) A=score byte #2.
89B0 ADC A,B Add (with carry) B to score byte #2 with BCD conversion.
89B1 DAA
89B2 LD (HL),A Update score byte #2.
89B3 DEC HL Move onto the next score byte.
89B4 LD A,(HL) A=score byte #1.
89B5 ADC A,$00 Add 00 (just the carry flag) to score byte #1 with BCD conversion.
89B7 DAA
89B8 LD (HL),A Update score byte #1.
Check the active player.
89B9 LD A,($5E65) If Flag_ActivePlayer is not zero, jump to Score_2UP.
89BC AND A
89BD JR NZ,Score_2UP
View the equivalent code in;
Prev: 894F Up: Map Next: 89BF