Prev: 51977 Up: Map Next: 52030
51993: Print Character
Used by the routine at PrintCharacterWithAttribute.
Prints a character on the screen, using the font whose address is held in FontPointer. A space is drawn as 60, which is blank in this font. The eight rows are written going down the screen, and the address is left at the top of the character.
After PrintScreen
print-character
Input
A The character
A' Attribute
HL Screen address of the top row
Output
HL Screen address of the top row
Turn a space into the font space.
PrintScreen 51993 CP 32 Jump to PrintGlyph if it is not a space.
51995 JR NZ,PrintGlyph
51997 LD A,60 Use the font space (60).
This entry point is used by the routine at PickUpItem.
Find the glyph.
PrintGlyph 51999 PUSH BC Stash BC, DE and the screen address on the stack.
52000 PUSH DE
52001 PUSH HL
52002 LD L,A Set HL to the character.
52003 LD H,0
52005 ADD HL,HL Multiply the character by eight.
52006 ADD HL,HL
52007 ADD HL,HL
Add the font address.
52008 LD DE,(48044) Fetch FontPointer.
52012 ADD HL,DE Add it to get the glyph address.
52013 EX DE,HL Point DE at the glyph.
52014 POP HL Restore the screen address from the stack.
Copy eight rows down the screen.
52015 LD B,8 Set a counter of 8 rows.
PrintGlyph_Loop 52017 LD A,(DE) Fetch a row of the glyph.
52018 INC DE Move on to the next row of the glyph.
52019 LD (HL),A Copy it to the screen.
52020 INC H Move HL down a row.
52021 DJNZ PrintGlyph_Loop Jump to PrintGlyph_Loop until all eight rows have been written.
Move back to the top of the character.
52023 POP DE Restore DE and BC from the stack.
52024 POP BC
52025 LD A,H Move HL back to the top row.
52026 SUB 8
52028 LD H,A
52029 RET Return.
Prev: 51977 Up: Map Next: 52030