Prev: A1AE Up: Map Next: A1F3
A1D3: Print Character
Used by the routines at Score_1UP, PrintStringColour and DrawSidePanel.
Prints a character at a screen address, using the graphics in the font that FontPointer points to, and moves on to the next character cell.
Before After
print-character-before print-character-after
Input
A The character code (the number of its graphic in the font)
HL The screen address
Output
HL The screen address of the next character cell
PrintScreen A1D3 PUSH BC Stash BC on the stack.
A1D4 PUSH DE Stash DE on the stack.
A1D5 PUSH HL Stash the screen address on the stack.
A1D6 LD L,A Fetch the character code.
A1D7 LD H,$00
A1D9 ADD HL,HL Multiply by 08 as each character has eight bytes of graphics.
A1DA ADD HL,HL
A1DB ADD HL,HL
A1DC LD DE,($5E01) Fetch the address of the font from FontPointer.
A1E0 ADD HL,DE Fetch the address of the graphics of the character.
A1E1 EX DE,HL Fetch the address of the graphics of the character.
A1E2 POP HL Restore the screen address from the stack.
A1E3 LD B,$08 B=08 (the number of rows).
PrintScreen_Loop A1E5 LD A,(DE) Fetch the next row of the graphics.
A1E6 LD (HL),A Write it to the screen.
A1E7 INC DE Move on to the next row of the graphics.
A1E8 INC H Move down a pixel row on the screen.
A1E9 DJNZ PrintScreen_Loop Decrease the row counter by one and loop back to PrintScreen_Loop until it is zero.
A1EB POP DE Restore DE from the stack.
A1EC POP BC Restore BC from the stack.
A1ED LD A,H Fetch the high byte of the screen address.
A1EE SUB $08 Subtract 08 to move back to the top row of the character.
A1F0 LD H,A Keep the high byte of the top row in H.
A1F1 INC L Move on to the next character cell.
A1F2 RET Return.
Prev: A1AE Up: Map Next: A1F3