Prev: 52654 Up: Map Next: 52754
52675: Apply Scoring
Used by the routine at 51943.
Scoring 52675 LD IX,53605 Calls Scoring_Prep three times with IX containing;
52679 CALL Scoring_Prep
52682 LD IX,53619
52686 CALL Scoring_Prep
52689 LD IX,53633
52693 CALL Scoring_Prep
52696 CALL Draw_Score Call Draw_Score.
52699 RET Return.
Passes the higher and lower score values to Scoring_Apply for the current door.
Scoring_Prep 52700 LD HL,52615 References Scoredigit05.
52703 LD B,(IX+6) Retrieves IX+$06, stores it in B then reset it to zero.
52706 LD (IX+6),0
52710 CALL Scoring_Apply Call Scoring_Apply.
52713 LD HL,52616 References Scoredigit04.
52716 LD B,(IX+7) Retrieves IX+$07, stores it in B then reset it to zero.
52719 LD (IX+7),0
52723 CALL Scoring_Apply Call Scoring_Apply.
52726 RET Return.
Applies the door scores into the player score.
Scoring_Apply 52727 LD A,(HL) Pass the current score digit to Scoring_Base_10 and overwrite the digit with the result.
52728 CALL Scoring_Base_10
52731 LD (HL),A
52732 LD E,5 Sets a counter to 5 (5 more digits in the score).
Scoring_Apply_Loop 52734 INC HL Move onto the next scoring digit.
52735 LD A,(HL) Pass the current score digit to Scoring_Base_10 and overwrite the digit with the result.
52736 CALL Scoring_Base_10
52739 LD (HL),A
52740 DEC E Loop back to Scoring_Apply_Loop until the counter is zero (and all scoring digits are accounted for).
52741 JR NZ,Scoring_Apply_Loop
52743 RET Return.
Ensures the current scoring digit remains 0-9 (if 10 then it's reset and the carry digit is forwarded on).
Scoring_Base_10 52744 ADD A,B Adds current score digit with passed score.
52745 LD B,0 Reset passed score to zero.
52747 CP 10 Return if result is less than 10 (base 10).
52749 RET C
52750 SUB 10 Subtract 10 to keep this digit in base 10 (e.g. "11" becomes "1", "12" becomes "2", and so on).
52752 INC B Add one onto the passed score (which carries onto the next digit as it goes lowest to highest) and return.
52753 RET
Prev: 52654 Up: Map Next: 52754