![]() |
Routines |
| Prev: 44340 | Up: Map | Next: 44408 |
|
Prints the player's BCD score from Score as a percentage, skipping leading zeros so "058%" becomes "58%" and "005%" becomes "5%".
|
||||
|
Print "You have scored ".
|
||||
| Print_Scoring | 44355 | LD HL,36 | HL=Messaging_YouHaveScored. | |
| 44358 | CALL PrintCompressedString | Call PrintCompressedString to print that compressed string. | ||
| 44361 | LD HL,(41223) | Fetch the BCD score from *Score into HL. | ||
|
Print the hundreds digit from the high score byte when it is non-zero.
|
||||
| 44364 | LD A,H | Copy the high score byte into A. | ||
| 44365 | AND %00001111 | Keep the hundreds digit and jump to Scoring_SecondDigit if it is zero. | ||
| 44367 | JR Z,Scoring_SecondDigit | |||
| 44369 | ADD A,48 | Convert the digit to ASCII by adding 48 and call PrintCharacter to print it. | ||
| 44371 | CALL PrintCharacter | |||
|
Print the tens digit from the low score byte, or a forced zero when hundreds already printed.
|
||||
| Scoring_SecondDigit | 44374 | LD A,L | Copy the low score byte into A. | |
| 44375 | AND %11110000 | Keep the tens digit and jump to Scoring_PrintTens if it is non-zero. | ||
| 44377 | JR NZ,Scoring_PrintTens | |||
|
The tens digit is zero, so skip it unless a hundreds digit was printed (avoid "05%"; show only "5%").
|
||||
| 44379 | LD A,H | Copy the high score byte into A again. | ||
| 44380 | AND A | Jump to Scoring_ThirdDigit if no hundreds digit was printed. | ||
| 44381 | JR Z,Scoring_ThirdDigit | |||
|
A hundreds digit was printed, so force a "0" tens digit.
|
||||
| 44383 | XOR A | Load 0 into A for printing. | ||
| Scoring_PrintTens | 44384 | RRCA | Shift the tens digit into bits 0-3 for printing. | |
| 44385 | RRCA | |||
| 44386 | RRCA | |||
| 44387 | RRCA | |||
| 44388 | ADD A,48 | Convert the digit to ASCII by adding 48 and call PrintCharacter to print it. | ||
| 44390 | CALL PrintCharacter | |||
|
Always print the units digit.
|
||||
| Scoring_ThirdDigit | 44393 | LD A,L | Copy the low score byte into A. | |
| 44394 | AND %00001111 | Keep the units digit in bits 0-3. | ||
| 44396 | ADD A,48 | Convert the digit to ASCII by adding 48 and call PrintCharacter to print it. | ||
| 44398 | CALL PrintCharacter | |||
|
Print "%.".
|
||||
| 44401 | LD HL,37 | HL=Messaging_Percentage. | ||
| 44404 | CALL PrintCompressedStringAndNewline | Call PrintCompressedStringAndNewline to print that compressed string and a newline. | ||
| 44407 | RET | Return. | ||
|
View the equivalent code in;
|
||||
| Prev: 44340 | Up: Map | Next: 44408 |