![]() |
Routines |
| Prev: 61678 | Up: Map | Next: 61797 |
|
Used by the routines at Draw_Score_Entry and Display_High_Score_Screen.
Prints a BCD-encoded score of B bytes from (HL) as decimal digits on screen, suppressing leading zeros. Each zero nibble advances the column by C without printing; once a non-zero digit is found, all remaining digits are printed. Each digit is positioned using an AT sequence (22) via PrintDispatch; D is the starting column, E is the row, and D advances by C after each digit.
|
||||||||||||||||
| Print_BCD_Score | 61703 | LD B,4 | Set the BCD byte count to 4. | |||||||||||||
|
This entry point is used by the routine at Draw_Score_Entry.
Leading zero suppression: skip zero nibbles, advancing the column.
|
||||||||||||||||
| Print_BCD_Score_Suppress_Loop | 61705 | LD A,(HL) | Read the high nibble of the current score byte; jump to Print_High_Digit to print it if non-zero. | |||||||||||||
| 61706 | SRL A | |||||||||||||||
| 61708 | SRL A | |||||||||||||||
| 61710 | SRL A | |||||||||||||||
| 61712 | SRL A | |||||||||||||||
| 61714 | JR NZ,Print_High_Digit | |||||||||||||||
| 61716 | LD A,D | Advance the column position past the suppressed high digit. | ||||||||||||||
| 61717 | ADD A,C | |||||||||||||||
| 61718 | LD D,A | |||||||||||||||
| 61719 | LD A,B | Jump to print the units digit via Read_Low_Digit if this is the last byte. | ||||||||||||||
| 61720 | CP 1 | |||||||||||||||
| 61722 | JR Z,Read_Low_Digit | |||||||||||||||
| 61724 | LD A,(HL) | Read the current score byte for the low nibble check. | ||||||||||||||
| 61725 | AND %00001111 | Isolate the low nibble. | ||||||||||||||
| 61727 | JR NZ,Print_Low_Digit | Jump to print it via Print_Low_Digit if non-zero. | ||||||||||||||
| 61729 | LD A,D | Advance the column position past the suppressed low digit. | ||||||||||||||
| 61730 | ADD A,C | |||||||||||||||
| 61731 | LD D,A | |||||||||||||||
| 61732 | INC HL | Move to the next score byte and repeat. | ||||||||||||||
| 61733 | DJNZ Print_BCD_Score_Suppress_Loop | |||||||||||||||
|
Digit print loop: print both nibbles of each remaining byte.
|
||||||||||||||||
| Print_BCD_Score_Print_Loop | 61735 | LD A,(HL) | Read the high nibble of the current score byte. | |||||||||||||
| 61736 | SRL A | |||||||||||||||
| 61738 | SRL A | |||||||||||||||
| 61740 | SRL A | |||||||||||||||
| 61742 | SRL A | |||||||||||||||
| Print_High_Digit | 61744 | ADD A,48 | Convert to ASCII and stash the digit character on the stack. | |||||||||||||
| 61746 | PUSH AF | |||||||||||||||
| 61747 | LD A,22 | Position the cursor at column D, row E via PrintDispatch and print the digit character. | ||||||||||||||
| 61749 | CALL PrintDispatch | |||||||||||||||
| 61752 | LD A,D | |||||||||||||||
| 61753 | CALL PrintDispatch | |||||||||||||||
| 61756 | LD A,E | |||||||||||||||
| 61757 | CALL PrintDispatch | |||||||||||||||
| 61760 | POP AF | |||||||||||||||
| 61761 | CALL PrintDispatch | |||||||||||||||
| 61764 | LD A,D | Advance the column position. | ||||||||||||||
| 61765 | ADD A,C | |||||||||||||||
| 61766 | LD D,A | |||||||||||||||
| Read_Low_Digit | 61767 | LD A,(HL) | Read the current score byte for the low nibble. | |||||||||||||
| 61768 | AND %00001111 | Isolate the low nibble. | ||||||||||||||
| Print_Low_Digit | 61770 | ADD A,48 | Convert to ASCII and stash the digit character on the stack. | |||||||||||||
| 61772 | PUSH AF | |||||||||||||||
| 61773 | LD A,22 | Position the cursor at column D, row E via PrintDispatch and print the digit character. | ||||||||||||||
| 61775 | CALL PrintDispatch | |||||||||||||||
| 61778 | LD A,D | |||||||||||||||
| 61779 | CALL PrintDispatch | |||||||||||||||
| 61782 | LD A,E | |||||||||||||||
| 61783 | CALL PrintDispatch | |||||||||||||||
| 61786 | POP AF | |||||||||||||||
| 61787 | CALL PrintDispatch | |||||||||||||||
| 61790 | LD A,D | Advance the column position. | ||||||||||||||
| 61791 | ADD A,C | |||||||||||||||
| 61792 | LD D,A | |||||||||||||||
| 61793 | INC HL | Move to the next score byte and repeat. | ||||||||||||||
| 61794 | DJNZ Print_BCD_Score_Print_Loop | |||||||||||||||
| 61796 | RET | Return. | ||||||||||||||
| Prev: 61678 | Up: Map | Next: 61797 |