Prev: 47931 Up: Map Next: 47972
47944: Print BCD Number
Used by the routines at DrawLives and PrintQuestPercentage.
Draws the digits of binary coded decimal bytes, two to a byte, into the buffer, using the digit glyphs at the start of the font.
Input
B Number of bytes
DE Address of the number
HL Address in the screen buffer
Point at the digit font.
PrintBCDNumber 47944 PUSH HL Stash the screen buffer address on the stack.
47945 LD HL,33621 Set FontPointer to Font.
47948 LD (42802),HL
47951 POP HL Restore the screen buffer address from the stack.
Print the upper digit of the byte.
47952 LD A,(DE) Fetch a byte of the number.
47953 RRCA Move the upper digit to the lowest four bits.
47954 RRCA
47955 RRCA
47956 RRCA
47957 AND %00001111 Keep only bits 0 to 3.
47959 CALL PrintCharacter Call PrintCharacter.
This entry point is used by the routine at PrintQuestPercentage.
Print the lower digit and move on.
PrintBCDNumber_Lower 47962 LD A,(DE) Fetch a byte of the number.
47963 AND %00001111 Keep only bits 0 to 3.
47965 CALL PrintCharacter Call PrintCharacter.
47968 INC DE Move on to the next byte.
47969 DJNZ PrintBCDNumber Jump to PrintBCDNumber until all of the bytes have been done.
47971 RET Return.
View the equivalent code in;
Prev: 47931 Up: Map Next: 47972