Prev: 29752 Up: Map Next: 29832
29800: Print Character
Prints a character on the screen, using the character set at 23606 (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 29800 PUSH BC Save the registers on the stack.
29801 PUSH DE
29802 PUSH HL
29803 LD L,A Create an offset in HL.
29804 LD H,0
29806 ADD HL,HL Multiply by 8 as there are eight bytes for each character.
29807 ADD HL,HL
29808 ADD HL,HL
29809 LD DE,(23606) Fetch the address of the font (CHARS).
29813 ADD HL,DE DE=HL + 15360. For examples of usage;
Letter ASCII Value * 8 (offset) CHARS + offset
"U" 85 680 16040
"L" 76 608 15968
"T" 84 672 16032
"I" 73 584 15944
"M" 77 616 15976
"A" 65 520 15880
"T" 84 672 16032
"E" 69 552 15912
29814 EX DE,HL
Print the character to the screen.
29815 POP HL Restore HL, containing the screen buffer location, from the stack.
This entry point is used by the routine at DisplayPlayerLives.
PrintCharacter_Draw 29816 LD B,8 Set the pixel row counter to 8 (8 rows of pixels).
PrintScreen_Loop 29818 LD A,(DE) Copy a byte from the font data to the screen buffer.
29819 LD (HL),A
29820 INC DE Move on to the next byte of the font data.
29821 INC H Move onto the next pixel line.
29822 DJNZ PrintScreen_Loop Decrease the pixel row counter by one and loop back to PrintScreen_Loop until all eight rows have been copied.
29824 POP DE Restore the registers from the stack.
29825 POP BC
Reset HL and move to the next column, ready to print the next character.
29826 LD A,H Move back to the top pixel row of the character cell (subtract 8 from H).
29827 SUB 8
29829 LD H,A
29830 INC L Increment screen column by one.
29831 RET Return.
Prev: 29752 Up: Map Next: 29832