Prev: 89BF Up: Map Next: 8A11
89EF: Print Character
Input
A ASCII value to print
HL Screen address
PrintScreen 89EF PUSH BC Stash BC, DE and HL on the stack.
89F0 PUSH DE
89F1 PUSH HL
89F2 SUB $20 Create an offset in HL.
89F4 LD L,A
89F5 LD H,$00
89F7 ADD HL,HL HL=HL * 8.
89F8 ADD HL,HL
89F9 ADD HL,HL
89FA LD DE,($5E04) DE=FontPointer (main font is MainFont).
89FE ADD HL,DE DE=HL + DE. For examples of usage;
Letter ASCII Value - 20 * 08 (offset) CHARS + offset
"U" 55 01A8 D4EF
"L" 4C 0160 D4A7
"T" 54 01A0 D4E7
"I" 49 0148 D48F
"M" 4D 0168 D4AF
"A" 41 0108 D44F
"T" 54 01A0 D4E7
"E" 45 0128 D46F
89FF EX DE,HL
Print the character to the screen.
8A00 POP HL Restore HL, containing the screen buffer location, from the stack.
This entry point is used by the routine at DisplayPlayerLives.
PrintScreen_0 8A01 LD B,$08 B=08 (08 rows of pixels).
PrintScreen_Loop 8A03 LD A,(DE) Copy a byte from the font data to the screen buffer.
8A04 LD (HL),A
8A05 INC DE Increment the font data by one.
8A06 INC H Move onto the next pixel line.
8A07 DJNZ PrintScreen_Loop Decrease counter by one and loop back to PrintScreen_Loop until counter is zero.
8A09 POP DE Restore DE and BC from the stack.
8A0A POP BC
Reset HL and move to the next column, ready to print the next character.
8A0B LD A,H H=H - 08 (reset the display line).
8A0C SUB $08
8A0E LD H,A
8A0F INC L Increment screen column by one.
8A10 RET Return.
View the equivalent code in;
Prev: 89BF Up: Map Next: 8A11