Prev: CDAE Up: Map Next: CE12
CDC3: Apply Scoring
Used by the routine at CAE7.
Scoring CDC3 LD IX,$D165 Calls Scoring_Prep three times with IX containing;
CDC7 CALL Scoring_Prep
CDCA LD IX,$D173
CDCE CALL Scoring_Prep
CDD1 LD IX,$D181
CDD5 CALL Scoring_Prep
CDD8 CALL Draw_Score Call Draw_Score.
CDDB RET Return.
Passes the higher and lower score values to Scoring_Apply for the current door.
Scoring_Prep CDDC LD HL,$CD87 References Scoredigit05.
CDDF LD B,(IX+$06) Retrieves IX+$06, stores it in B then reset it to zero.
CDE2 LD (IX+$06),$00
CDE6 CALL Scoring_Apply Call Scoring_Apply.
CDE9 LD HL,$CD88 References Scoredigit04.
CDEC LD B,(IX+$07) Retrieves IX+$07, stores it in B then reset it to zero.
CDEF LD (IX+$07),$00
CDF3 CALL Scoring_Apply Call Scoring_Apply.
CDF6 RET Return.
Applies the door scores into the player score.
Scoring_Apply CDF7 LD A,(HL) Pass the current score digit to Scoring_Base_10 and overwrite the digit with the result.
CDF8 CALL Scoring_Base_10
CDFB LD (HL),A
CDFC LD E,$05 Sets a counter to 05 (5 more digits in the score).
Scoring_Apply_Loop CDFE INC HL Move onto the next scoring digit.
CDFF LD A,(HL) Pass the current score digit to Scoring_Base_10 and overwrite the digit with the result.
CE00 CALL Scoring_Base_10
CE03 LD (HL),A
CE04 DEC E Loop back to Scoring_Apply_Loop until the counter is zero (and all scoring digits are accounted for).
CE05 JR NZ,Scoring_Apply_Loop
CE07 RET Return.
Ensures the current scoring digit remains 0-9 (if $0A then it's reset and the carry digit is forwarded on).
Scoring_Base_10 CE08 ADD A,B Adds current score digit with passed score.
CE09 LD B,$00 Reset passed score to zero.
CE0B CP $0A Return if result is less than $0A (base 10).
CE0D RET C
CE0E SUB $0A Subtract $0A to keep this digit in base 10 (e.g. "11" becomes "1", "12" becomes "2", and so on).
CE10 INC B Add one onto the passed score (which carries onto the next digit as it goes lowest to highest) and return.
CE11 RET
Prev: CDAE Up: Map Next: CE12