Prev: 49919 Up: Map Next: 49970
49940: Print BCD Number
Used by the routine at PrintPercentage.
Prints a number which is held in BCD, using the font with the digits. Entering at PrintBCDNumber_LowerDigit prints only the lower digit of the first byte.
Input
B Number of bytes
DE Address of the number
HL Screen address of the first digit
Point at the digit font.
PrintBCDNumber 49940 PUSH HL Stash the screen address on the stack.
49941 LD HL,27870 Set FontPointer to Font.
49944 LD (48044),HL
49947 POP HL Restore the screen address from the stack.
Print the upper digit of the byte.
PrintBCDNumber_Loop 49948 LD A,(DE) Fetch a byte of the number.
49949 RRCA Move the upper digit to the lowest four bits.
49950 RRCA
49951 RRCA
49952 RRCA
49953 AND %00001111 Keep only bits 0 to 3.
49955 CALL PrintCharacterWithAttribute Call PrintCharacterWithAttribute.
49958 INC L Move on to the next screen position.
This entry point is used by the routines at PrintPercentage and PrintScore.
Print the lower digit and move on.
PrintBCDNumber_LowerDigit 49959 LD A,(DE) Fetch a byte of the number.
49960 AND %00001111 Keep only bits 0 to 3.
49962 CALL PrintCharacterWithAttribute Call PrintCharacterWithAttribute.
49965 INC L Move on to the next screen position.
49966 INC DE Move on to the next byte.
49967 DJNZ PrintBCDNumber_Loop Jump to PrintBCDNumber_Loop until all of the bytes have been printed.
49969 RET Return.
View the equivalent code in;
Prev: 49919 Up: Map Next: 49970