Prev: 48716 Up: Map Next: 48803
48767: 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), 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
Find the glyph.
PrintCharacter 48767 PUSH BC Stash BC, DE and the screen buffer address on the stack.
48768 PUSH DE
48769 PUSH HL
48770 LD L,A Set HL to the character.
48771 LD H,0
48773 ADD HL,HL Multiply the character by eight.
48774 ADD HL,HL
48775 ADD HL,HL
Add the font address.
48776 LD DE,(23495) Fetch FontPointer.
48780 ADD HL,DE Add it to get the glyph address.
48781 EX DE,HL Point DE at the glyph.
48782 POP HL Restore the screen buffer address from the stack.
Copy eight rows down the buffer.
48783 LD B,8 Set a counter of 8 rows.
PrintCharacter_NextRow 48785 LD A,(DE) Copy a row of the glyph to the buffer.
48786 LD (HL),A
48787 INC DE Move on to the next row of the glyph.
48788 PUSH BC Stash the row counter on the stack.
48789 LD BC,65504 Move HL down a row.
48792 ADD HL,BC
48793 POP BC Restore the row counter from the stack.
48794 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.
48796 POP DE Restore DE from the stack.
48797 LD BC,257 Move HL on by 0257.
48800 ADD HL,BC
48801 POP BC Restore BC from the stack.
48802 RET Return.
View the equivalent code in;
Prev: 48716 Up: Map Next: 48803