Prev: B589 Up: Map Next: B5CC
B5A9: Add Points To Score
Used by the routines at A18C, A323 and A4B3.
Input
BC Points to add to score
Check the active player.
AddPointsToScore B5A9 LD A,($969E) If Flag_ActivePlayer is not zero, jump to AddPointsToScore_2UP.
B5AC AND A
B5AD JR NZ,AddPointsToScore_2UP
Set the score address for 1UP.
B5AF LD HL,$969A HL=1UP_Score_3.
B5B2 JR AddPointsToScore_Start Jump to AddPointsToScore_Start.
Set the score address for 2UP.
AddPointsToScore_2UP B5B4 LD HL,$969D HL=2UP_Score_3.
Process adding the points to the appropriate score.
AddPointsToScore_Start B5B7 LD A,(HL) A=score byte #3.
B5B8 ADD A,C Add C to score byte #3 with BCD conversion.
B5B9 DAA
B5BA LD (HL),A Update score byte #3.
B5BB DEC HL Move onto the next score byte.
B5BC LD A,(HL) A=score byte #2.
B5BD ADC A,B Add (with carry) B to score byte #2 with BCD conversion.
B5BE DAA
B5BF LD (HL),A Update score byte #2.
B5C0 DEC HL Move onto the next score byte.
B5C1 LD A,(HL) A=score byte #1.
B5C2 ADC A,$00 Add 00 (i.e. just the carry flag) to score byte #1 with BCD conversion.
B5C4 DAA
B5C5 LD (HL),A Update score byte #1.
Check the active player.
B5C6 LD A,($969E) If Flag_ActivePlayer is not zero, jump to Score_2UP.
B5C9 AND A
B5CA JR NZ,Score_2UP
View the equivalent code in;
Prev: B589 Up: Map Next: B5CC