Prev: 6C96 Up: Map Next: 6CDE
6CB6: Print Scores
Used by the routines at AddPointsToScore and CreateWindow.
Prints the score or the high score at the top of the screen, as six BCD digits. The same code (from PrintScore) also prints other BCD numbers, such as the miles and the time.
Before After
print-scores-before print-scores-after
Sets up the player score.
Score_1UP 6CB6 LD HL,$400D HL=400D (screen location of the score).
6CB9 LD DE,$5E4C Point DE at the score (Score_1).
6CBC JR PrintScore Jump to PrintScore.
This entry point is used by the routine at CreateWindow.
Sets up the HI score.
Score_HI 6CBE LD HL,$4018 HL=4018 (screen location of the high score).
6CC1 LD DE,$5E49 Point DE at the high score (High_Score).
Prints the score. Entering at PrintScore_Loop prints B bytes (two digits each) of the BCD number at DE to the screen location in HL.
PrintScore 6CC4 LD B,$03 Set the byte counter to 03 (a score is 03 bytes, so 06 digits).
This entry point is used by the routine at DisplayMiles.
PrintScore_Loop 6CC6 LD A,(DE) Fetch the next byte of the number, which holds two digits.
6CC7 RRCA A=A / 10 (the first digit).
6CC8 RRCA
6CC9 RRCA
6CCA RRCA
6CCB AND %00001111 Keep only bits 0-3.
6CCD ADD A,$30 Add 30 to convert the digit to ASCII.
6CCF CALL PrintScreen Call PrintScreen to print the digit.
This entry point is used by the routines at DisplayCupsCollected, DisplayMiles and PrintBestTime.
Prints the second digit of the byte; entering here skips the first digit.
PrintScore_SecondDigit 6CD2 LD A,(DE) Fetch the byte again, for the second digit.
6CD3 AND %00001111 Keep only bits 0-3.
6CD5 ADD A,$30 Add 30 to convert the digit to ASCII.
6CD7 CALL PrintScreen Call PrintScreen to print the digit.
6CDA INC DE Move on to the next byte of the number.
6CDB DJNZ PrintScore_Loop Decrease the byte counter by one and loop back to PrintScore_Loop until all of the bytes have been printed.
6CDD RET Return.
View the equivalent code in;
Prev: 6C96 Up: Map Next: 6CDE