Prev: BE4C Up: Map Next: BEA3
BE7F: Print Character
Used by the routines at PrintBCDNumber and PrintText.
Prints a character in the screen buffer, using the font whose address is held in FontPointer. 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
Find the glyph.
PrintCharacter BE7F PUSH BC Stash BC, DE and the screen buffer address on the stack.
BE80 PUSH DE
BE81 PUSH HL
BE82 LD L,A Set HL to the character.
BE83 LD H,$00
BE85 ADD HL,HL Multiply the character by eight.
BE86 ADD HL,HL
BE87 ADD HL,HL
Add the font address.
BE88 LD DE,($5BC7) Fetch FontPointer.
BE8C ADD HL,DE Add it to get the glyph address.
BE8D EX DE,HL Point DE at the glyph.
BE8E POP HL Restore the screen buffer address from the stack.
Copy eight rows down the buffer.
BE8F LD B,$08 Set a counter of 08 rows.
PrintCharacter_NextRow BE91 LD A,(DE) Copy a row of the glyph to the buffer.
BE92 LD (HL),A
BE93 INC DE Move on to the next row of the glyph.
BE94 PUSH BC Stash the row counter on the stack.
BE95 LD BC,$FFE0 Move HL down a row.
BE98 ADD HL,BC
BE99 POP BC Restore the row counter from the stack.
BE9A 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.
BE9C POP DE Restore DE from the stack.
BE9D LD BC,$0101 Move HL on by 0101.
BEA0 ADD HL,BC
BEA1 POP BC Restore BC from the stack.
BEA2 RET Return.
View the equivalent code in;
Prev: BE4C Up: Map Next: BEA3