Prev: 41390 Up: Map Next: 41459
41427: 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 41427 PUSH BC Stash BC on the stack.
41428 PUSH DE Stash DE on the stack.
41429 PUSH HL Stash the screen address on the stack.
41430 LD L,A Fetch the character code.
41431 LD H,0
41433 ADD HL,HL Multiply by 8 as each character has eight bytes of graphics.
41434 ADD HL,HL
41435 ADD HL,HL
41436 LD DE,(24065) Fetch the address of the font from FontPointer.
41440 ADD HL,DE Fetch the address of the graphics of the character.
41441 EX DE,HL Fetch the address of the graphics of the character.
41442 POP HL Restore the screen address from the stack.
41443 LD B,8 B=8 (the number of rows).
PrintScreen_Loop 41445 LD A,(DE) Fetch the next row of the graphics.
41446 LD (HL),A Write it to the screen.
41447 INC DE Move on to the next row of the graphics.
41448 INC H Move down a pixel row on the screen.
41449 DJNZ PrintScreen_Loop Decrease the row counter by one and loop back to PrintScreen_Loop until it is zero.
41451 POP DE Restore DE from the stack.
41452 POP BC Restore BC from the stack.
41453 LD A,H Fetch the high byte of the screen address.
41454 SUB 8 Subtract 8 to move back to the top row of the character.
41456 LD H,A Keep the high byte of the top row in H.
41457 INC L Move on to the next character cell.
41458 RET Return.
Prev: 41390 Up: Map Next: 41459