Prev: 8A37 Up: Map Next: 8A61
8A3D: Print String
Input
HL Pointer to string
DE Screen buffer location
Print_String 8A3D LD A,(HL) Fetch a character from the string pointer and store it in A.
8A3E PUSH HL Stash the string pointer on the stack.
8A3F AND %01111111 Strip off the termination bit.
Fetch the font UDG for the current character.
8A41 LD L,A Create an offset in HL.
8A42 LD H,$00
8A44 ADD HL,HL Letter UDGs are 08 bytes, so multiply HL by 08.
8A45 ADD HL,HL
8A46 ADD HL,HL
8A47 LD BC,$F740 Add Font to HL to reference the UDG for the current letter in the string.
8A4A ADD HL,BC
Now print it to the screen buffer.
8A4B CALL Print_Character Call Print_Character.
8A4E POP HL Restore the string pointer from the stack.
8A4F INC DE Increment the screen buffer pointer by one.
8A50 BIT 7,(HL) Test for the termination bit in the current letter *HL.
8A52 INC HL Increment the string pointer by one.
8A53 JR Z,Print_String Jump to Print_String until the terminator bit is found.
8A55 RET Return.
Printing routine.
Print_Character 8A56 LD B,$08 Set a counter in B of 08 for the number of bytes in a letter UDG.
8A58 PUSH DE Stash the screen buffer pointer on the stack.
Print_Character_Loop 8A59 LD A,(HL) Fetch the letter UDG byte from *HL...
8A5A LD (DE),A ...and write it to the screen buffer using the position stored in *DE.
8A5B INC HL Increment the string pointer by one.
8A5C INC D Move right one byte to the next screen buffer position.
8A5D DJNZ Print_Character_Loop Decrease the UDG byte counter by one and loop back to Print_Character_Loop until the letter has been printed to the screen.
8A5F POP DE Restore the screen buffer pointer from the stack.
8A60 RET Return.
Prev: 8A37 Up: Map Next: 8A61