Prev: 7438 Up: Map Next: 7488
7468: Print Character
Prints a character on the screen, using the character set at 5C36 (CHARS), as eight rows of pixels. The screen address is then moved on by one column, ready to print the next character.
Input
A ASCII value to print
HL Screen address
Output
HL Screen address of the next character
PrintScreen 7468 PUSH BC Save the registers on the stack.
7469 PUSH DE
746A PUSH HL
746B LD L,A Create an offset in HL.
746C LD H,$00
746E ADD HL,HL Multiply by 08 as there are eight bytes for each character.
746F ADD HL,HL
7470 ADD HL,HL
7471 LD DE,($5C36) Fetch the address of the font (CHARS).
7475 ADD HL,DE DE=HL + 3C00. For examples of usage;
Letter ASCII Value * 8 (offset) CHARS + offset
"U" 55 02A8 3EA8
"L" 4C 0260 3E60
"T" 54 02A0 3EA0
"I" 49 0248 3E48
"M" 4D 0268 3E68
"A" 41 0208 3E08
"T" 54 02A0 3EA0
"E" 45 0228 3E28
7476 EX DE,HL
Print the character to the screen.
7477 POP HL Restore HL, containing the screen buffer location, from the stack.
This entry point is used by the routine at DisplayPlayerLives.
PrintCharacter_Draw 7478 LD B,$08 Set the pixel row counter to 08 (08 rows of pixels).
PrintScreen_Loop 747A LD A,(DE) Copy a byte from the font data to the screen buffer.
747B LD (HL),A
747C INC DE Move on to the next byte of the font data.
747D INC H Move onto the next pixel line.
747E DJNZ PrintScreen_Loop Decrease the pixel row counter by one and loop back to PrintScreen_Loop until all eight rows have been copied.
7480 POP DE Restore the registers from the stack.
7481 POP BC
Reset HL and move to the next column, ready to print the next character.
7482 LD A,H Move back to the top pixel row of the character cell (subtract 08 from H).
7483 SUB $08
7485 LD H,A
7486 INC L Increment screen column by one.
7487 RET Return.
Prev: 7438 Up: Map Next: 7488