.Print234DigitBCD LDA #2 \ Print two spaces JSR PrintSpaces LDA #%00100000 \ Set G = %00100000, so if we print the high byte and STA G \ the first digit is 0, it will be replaced by a space LDA totalPointsHi,X \ Set A to the X-th totalPointsHi value BNE Print4DigitBCD \ If A is non-zero, jump to Print4DigitBCD to print the \ (totalPointsHi totalPointsLo) for driver X as a \ four-digit number LDA #2 \ Otherwise print two spaces for the first two digits, JSR PrintSpaces \ as the high byte is zero LSR G \ Shift G right one place to give to %00010000, so the \ next call to Print2DigitBCD will print a space for the \ first digit if it is zero BNE Print4DigitBCD+3 \ Jump to Print4DigitBCD+3 to print the second two \ digits in totalPointsLo (this BNE is effectively a JMP \ as the result of the LSR is never zero)Name: Print234DigitBCD [Show more] Type: Subroutine Category: Text Summary: Print a specific driver's accumulated points as a padded two-, three- or four-digit numberContext: See this subroutine in context in the source code References: This subroutine is called as follows: * PrintDriverTable calls Print234DigitBCD
Print (totalPointsHi totalPointsLo) for driver X as a four-digit number, followed by a space. The first two digits are printed as spaces if the high byte is zero, and the third digit is printed as a space if applicable.
[X]
Subroutine Print4DigitBCD (category: Text)
Print a specific driver's accumulated points as a four-digit number
[X]
Entry point Print4DigitBCD+3 in subroutine Print4DigitBCD (category: Text)
Do not print the first two digits (i.e. omit printing A)
[X]
Subroutine PrintSpaces (category: Text)
Print the specified number of spaces
[X]
Variable totalPointsHi (category: Drivers)
High byte of total accumulated points for each driver