Prev: 7415 Up: Map Next: 7468
7438: Print Scores
Used by the routine at CreateWindow.
Prints a score, as six digits, on the screen. This routine is entered at Score_1UP to print the 1UP score, at Score_2UP to print the 2UP score and at Score_HI to print the high score.
Before
print-scores-before
After
print-scores-after
Sets up the 1UP score.
Score_1UP 7438 LD HL,$4021 Set the screen buffer address for the 1UP score (4021).
743B LD DE,$5F0E Point DE at 1UP_Score_1.
743E JR PrintScore Jump to PrintScore.
This entry point is used by the routines at CreateWindow and AddPointsToScore.
Sets up the 2UP score.
Score_2UP 7440 LD HL,$4039 Set the screen buffer address for the 2UP score (4039).
7443 LD DE,$5F11 Point DE at 2UP_Score_1.
7446 JR PrintScore Jump to PrintScore.
This entry point is used by the routine at CreateWindow.
Sets up the HI score.
Score_HI 7448 LD HL,$402D Set the screen buffer address for the HI score (402D).
744B LD DE,$5F09 Point DE at High_Score.
Prints the score.
PrintScore 744E LD B,$03 Set the byte counter to 03.
This entry point is used by the routine at TakeIngredients.
PrintScore_Loop 7450 LD A,(DE) Fetch a byte of the score.
7451 RRCA Shift the tens digit down (divide by 10).
7452 RRCA
7453 RRCA
7454 RRCA
7455 AND %00001111 Keep only bits 0-3.
7457 ADD A,$30 Convert the digit to ASCII (add 30 which is "0").
7459 CALL PrintScreen Print the digit using PrintScreen.
745C LD A,(DE) Fetch the byte of the score again.
745D AND %00001111 Keep only bits 0-3.
745F ADD A,$30 Convert the digit to ASCII (add 30 which is "0").
7461 CALL PrintScreen Print the digit using PrintScreen.
7464 INC DE Move on to the next byte of the score.
7465 DJNZ PrintScore_Loop Decrease the byte counter by one and loop back to PrintScore_Loop until all three bytes have been printed.
7467 RET Return.
View the equivalent code in;
Prev: 7415 Up: Map Next: 7468