Prev: 35383 Up: Map Next: 35425
35389: Print String
Input
HL Pointer to string
DE Screen buffer location
Print_String 35389 LD A,(HL) Fetch a character from the string pointer and store it in A.
35390 PUSH HL Stash the string pointer on the stack.
35391 AND %01111111 Strip off the termination bit.
Fetch the font UDG for the current character.
35393 LD L,A Create an offset in HL.
35394 LD H,0
35396 ADD HL,HL Letter UDGs are 8 bytes, so multiply HL by 8.
35397 ADD HL,HL
35398 ADD HL,HL
35399 LD BC,63296 Add Font to HL to reference the UDG for the current letter in the string.
35402 ADD HL,BC
Now print it to the screen buffer.
35403 CALL Print_Character Call Print_Character.
35406 POP HL Restore the string pointer from the stack.
35407 INC DE Increment the screen buffer pointer by one.
35408 BIT 7,(HL) Test for the termination bit in the current letter *HL.
35410 INC HL Increment the string pointer by one.
35411 JR Z,Print_String Jump to Print_String until the terminator bit is found.
35413 RET Return.
Printing routine.
Print_Character 35414 LD B,8 Set a counter in B of 8 for the number of bytes in a letter UDG.
35416 PUSH DE Stash the screen buffer pointer on the stack.
Print_Character_Loop 35417 LD A,(HL) Fetch the letter UDG byte from *HL...
35418 LD (DE),A ...and write it to the screen buffer using the position stored in *DE.
35419 INC HL Increment the string pointer by one.
35420 INC D Move right one byte to the next screen buffer position.
35421 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.
35423 POP DE Restore the screen buffer pointer from the stack.
35424 RET Return.
Prev: 35383 Up: Map Next: 35425