Prev: 7325 Up: Map Next: 739D
737A: Add Points To Score
Used by the routines at KillLeech, SlugWeaponHit and CollectBonusItem.
Adds a number of points to the score of the active player. The points are given as a two byte BCD number and the score is stored as three BCD bytes with the most significant byte first.
Input
BC Points to add to score
Check the active player.
AddPointsToScore 737A LD A,($5E1E) If Current_Player is not zero, jump to AddPointsToScore_2UP.
737D AND A
737E JR NZ,AddPointsToScore_2UP
Set the score address for 1UP.
7380 LD HL,$5E07 HL=1UP_Score_3.
7383 JR AddPointsToScore_Start Jump to AddPointsToScore_Start.
Set the score address for 2UP.
AddPointsToScore_2UP 7385 LD HL,$5E0A HL=2UP_Score_3.
Process adding the points to the appropriate score.
AddPointsToScore_Start 7388 LD A,(HL) A=score byte #3.
7389 ADD A,C Add C to score byte #3 with BCD conversion.
738A DAA
738B LD (HL),A Update score byte #3.
738C DEC HL Move onto the next score byte.
738D LD A,(HL) A=score byte #2.
738E ADC A,B Add (with carry) B to score byte #2 with BCD conversion.
738F DAA
7390 LD (HL),A Update score byte #2.
7391 DEC HL Move onto the next score byte.
7392 LD A,(HL) A=score byte #1.
7393 ADC A,$00 Add 00 (i.e. just the carry flag) to score byte #1 with BCD conversion.
7395 DAA
7396 LD (HL),A Update score byte #1.
Check the active player.
7397 LD A,($5E1E) If Current_Player is not zero (the active player is 2UP), jump to Score_2UP.
739A AND A
739B JR NZ,Score_2UP
Prev: 7325 Up: Map Next: 739D