Prev: BBB1 Up: Map Next: BC15
BBEB: Print Character
Used by the routines at PrintBCDBytes, PrintLowDigit and PrintTextStandardFont.
Prints a character in the screen buffer, using the font whose address is held in FontPointer. A space is drawn as 3D, which is blank in this font. The eight rows are written going down the buffer (see ScreenBuffer), 20 bytes apart, and the address is left at the top of the next character.
Input
A The character
HL Address in the screen buffer of the top row
Output
HL Address of the top row of the next character
Turn a space into the font space.
PrintCharacter BBEB CP $20 Jump to PrintCharacter_Find if it is not a space.
BBED JR NZ,PrintCharacter_Find
BBEF LD A,$3D Use the font space (3D).
Find the glyph.
PrintCharacter_Find BBF1 PUSH BC Stash BC, DE and the screen buffer address on the stack.
BBF2 PUSH DE
BBF3 PUSH HL
BBF4 LD L,A Set HL to the character.
BBF5 LD H,$00
BBF7 ADD HL,HL Multiply the character by eight.
BBF8 ADD HL,HL
BBF9 ADD HL,HL
This entry point is used by the routine at PrintCounterDigit.
Add the font address.
PrintCharacter_Offset BBFA LD DE,($5B27) Fetch FontPointer.
BBFE ADD HL,DE Add it to get the glyph address.
BBFF EX DE,HL Point DE at the glyph.
BC00 POP HL Restore the screen buffer address from the stack.
Copy eight rows down the buffer.
BC01 LD B,$08 Set a counter of 08 rows.
PrintCharacter_NextRow BC03 LD A,(DE) Copy a row of the glyph to the buffer.
BC04 LD (HL),A
BC05 INC DE Move on to the next row of the glyph.
BC06 PUSH BC Stash the row counter on the stack.
BC07 LD BC,$FFE0 Move HL down a row.
BC0A ADD HL,BC
BC0B POP BC Restore the row counter from the stack.
BC0C DJNZ PrintCharacter_NextRow Jump to PrintCharacter_NextRow until all eight rows have been written.
Move on to the next character, eight lines up and one byte to the right.
BC0E POP DE Restore DE from the stack.
BC0F LD BC,$0101 Move HL on by 0101.
BC12 ADD HL,BC
BC13 POP BC Restore BC from the stack.
BC14 RET Return.
View the equivalent code in;
Prev: BBB1 Up: Map Next: BC15