Prev: 46473 Up: Map Next: 46540
46505: Add Points To Score
Used by the routines at 41356, 41763 and 42163.
Input
BC Points to add to score
Check the active player.
AddPointsToScore 46505 LD A,(38558) If Flag_ActivePlayer is not zero, jump to AddPointsToScore_2UP.
46508 AND A
46509 JR NZ,AddPointsToScore_2UP
Set the score address for 1UP.
46511 LD HL,38554 HL=1UP_Score_3.
46514 JR AddPointsToScore_Start Jump to AddPointsToScore_Start.
Set the score address for 2UP.
AddPointsToScore_2UP 46516 LD HL,38557 HL=2UP_Score_3.
Process adding the points to the appropriate score.
AddPointsToScore_Start 46519 LD A,(HL) A=score byte #3.
46520 ADD A,C Add C to score byte #3 with BCD conversion.
46521 DAA
46522 LD (HL),A Update score byte #3.
46523 DEC HL Move onto the next score byte.
46524 LD A,(HL) A=score byte #2.
46525 ADC A,B Add (with carry) B to score byte #2 with BCD conversion.
46526 DAA
46527 LD (HL),A Update score byte #2.
46528 DEC HL Move onto the next score byte.
46529 LD A,(HL) A=score byte #1.
46530 ADC A,0 Add 0 (i.e. just the carry flag) to score byte #1 with BCD conversion.
46532 DAA
46533 LD (HL),A Update score byte #1.
Check the active player.
46534 LD A,(38558) If Flag_ActivePlayer is not zero, jump to Score_2UP.
46537 AND A
46538 JR NZ,Score_2UP
View the equivalent code in;
Prev: 46473 Up: Map Next: 46540