Prev: CB09 Up: Map Next: CB3E
CB19: 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 3C, 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 CB19 CP $20 Jump to PrintGlyph if it is not a space.
CB1B JR NZ,PrintGlyph
CB1D LD A,$3C Use the font space (3C).
This entry point is used by the routine at PickUpItem.
Find the glyph.
PrintGlyph CB1F PUSH BC Stash BC, DE and the screen address on the stack.
CB20 PUSH DE
CB21 PUSH HL
CB22 LD L,A Set HL to the character.
CB23 LD H,$00
CB25 ADD HL,HL Multiply the character by eight.
CB26 ADD HL,HL
CB27 ADD HL,HL
Add the font address.
CB28 LD DE,($BBAC) Fetch FontPointer.
CB2C ADD HL,DE Add it to get the glyph address.
CB2D EX DE,HL Point DE at the glyph.
CB2E POP HL Restore the screen address from the stack.
Copy eight rows down the screen.
CB2F LD B,$08 Set a counter of 08 rows.
PrintGlyph_Loop CB31 LD A,(DE) Fetch a row of the glyph.
CB32 INC DE Move on to the next row of the glyph.
CB33 LD (HL),A Copy it to the screen.
CB34 INC H Move HL down a row.
CB35 DJNZ PrintGlyph_Loop Jump to PrintGlyph_Loop until all eight rows have been written.
Move back to the top of the character.
CB37 POP DE Restore DE and BC from the stack.
CB38 POP BC
CB39 LD A,H Move HL back to the top row.
CB3A SUB $08
CB3C LD H,A
CB3D RET Return.
Prev: CB09 Up: Map Next: CB3E