Prev: 48049 Up: Map Next: 48149
48107: 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 61, which is blank in this font. The eight rows are written going down the buffer (see ScreenBuffer), 32 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 48107 CP 32 Jump to PrintCharacter_Find if it is not a space.
48109 JR NZ,PrintCharacter_Find
48111 LD A,61 Use the font space (61).
Find the glyph.
PrintCharacter_Find 48113 PUSH BC Stash BC, DE and the screen buffer address on the stack.
48114 PUSH DE
48115 PUSH HL
48116 LD L,A Set HL to the character.
48117 LD H,0
48119 ADD HL,HL Multiply the character by eight.
48120 ADD HL,HL
48121 ADD HL,HL
This entry point is used by the routine at PrintCounterDigit.
Add the font address.
PrintCharacter_Offset 48122 LD DE,(23335) Fetch FontPointer.
48126 ADD HL,DE Add it to get the glyph address.
48127 EX DE,HL Point DE at the glyph.
48128 POP HL Restore the screen buffer address from the stack.
Copy eight rows down the buffer.
48129 LD B,8 Set a counter of 8 rows.
PrintCharacter_NextRow 48131 LD A,(DE) Copy a row of the glyph to the buffer.
48132 LD (HL),A
48133 INC DE Move on to the next row of the glyph.
48134 PUSH BC Stash the row counter on the stack.
48135 LD BC,65504 Move HL down a row.
48138 ADD HL,BC
48139 POP BC Restore the row counter from the stack.
48140 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.
48142 POP DE Restore DE from the stack.
48143 LD BC,257 Move HL on by 0257.
48146 ADD HL,BC
48147 POP BC Restore BC from the stack.
48148 RET Return.
View the equivalent code in;
Prev: 48049 Up: Map Next: 48149