Skip to navigation


Text: pr2

[Commodore 64 version]

Name: pr2 [Show more] Type: Subroutine Category: Text Summary: Print an 8-bit number, left-padded to 3 digits, and optional point
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * EQSHP calls pr2 * fwl calls pr2 * tal calls pr2 * TT210 calls pr2 * TT25 calls pr2 * TT151 calls via pr2+2

Print the 8-bit number in X to 3 digits, left-padding with spaces for numbers with fewer than 3 digits (so numbers < 100 are right-aligned). Optionally include a decimal point.
Arguments: X The number to print C flag If set, include a decimal point
Other entry points: pr2+2 Print the 8-bit number in X to the number of digits in A
.pr2 LDA #3 ; Set A to the number of digits (3) LDY #0 ; Zero the Y register, so we can fall through into TT11 ; to print the 16-bit number (Y X) to 3 digits, which ; effectively prints X to 3 digits as the high byte is ; zero