Prev: BB3B Up: Map Next: BB64
BB48: 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 BB48 PUSH HL Stash the screen buffer address on the stack.
BB49 LD HL,$8355 Set FontPointer to Font.
BB4C LD ($A732),HL
BB4F POP HL Restore the screen buffer address from the stack.
Print the upper digit of the byte.
BB50 LD A,(DE) Fetch a byte of the number.
BB51 RRCA Move the upper digit to the lowest four bits.
BB52 RRCA
BB53 RRCA
BB54 RRCA
BB55 AND %00001111 Keep only bits 0 to 3.
BB57 CALL PrintCharacter Call PrintCharacter.
This entry point is used by the routine at PrintQuestPercentage.
Print the lower digit and move on.
PrintBCDNumber_Lower BB5A LD A,(DE) Fetch a byte of the number.
BB5B AND %00001111 Keep only bits 0 to 3.
BB5D CALL PrintCharacter Call PrintCharacter.
BB60 INC DE Move on to the next byte.
BB61 DJNZ PrintBCDNumber Jump to PrintBCDNumber until all of the bytes have been done.
BB63 RET Return.
View the equivalent code in;
Prev: BB3B Up: Map Next: BB64