Prev: 48709 Up: Map Next: 48767
48716: Print Text
Used by the routine at PrintDayCaption.
Prints a line of text, which starts with its attribute, using the font whose address is held in FontPointer. The last character of the text has bit 7 set. Each character cell has its attribute set as well. The pixel position is on the stack.
Input
DE Address of the text
Fetch the attribute from the text.
PrintText 48716 POP BC Copy the pixel position to BC (using the stack).
48717 PUSH BC
48718 CALL CalculateBufferAddress Call CalculateBufferAddress.
48721 LD L,C Copy it to HL.
48722 LD H,B
48723 LD A,(DE) Fetch the attribute of the text.
48724 EX AF,AF' Keep the attribute in AF'.
48725 INC DE Move on to the first character.
This entry point is used by the routine at PrintTextSingleColour.
Find the attribute address.
PrintText_Setup 48726 EXX Switch to the shadow registers.
48727 POP HL Fetch the pixel position.
48728 PUSH DE Stash the address of the text on the stack.
48729 CALL CalculateAttributeAddress Call CalculateAttributeAddress.
48732 LD L,E Copy it to HL.
48733 LD H,D
48734 POP DE Restore the address of the text from the stack.
Print each character and set its attribute.
PrintText_NextCharacter 48735 EXX Switch back to the main registers.
48736 LD A,(DE) Fetch a character of the text.
48737 BIT 7,A Jump to PrintText_LastCharacter if it is the last.
48739 JR NZ,PrintText_LastCharacter
48741 PUSH DE Stash the address of the text on the stack.
48742 CALL PrintCharacter Call PrintCharacter.
48745 POP DE Restore the address of the text from the stack.
48746 INC DE Move on to the next character.
48747 EXX Switch to the shadow registers.
48748 EX AF,AF' Fetch the attribute.
48749 LD (HL),A Set the attribute of the cell.
48750 INC L Move on to the next cell.
48751 EX AF,AF' Keep the attribute in AF'.
48752 JR PrintText_NextCharacter Jump to PrintText_NextCharacter.
Print the last character.
PrintText_LastCharacter 48754 AND %01111111 Keep only bits 0 to 6.
48756 PUSH DE Stash the address of the text on the stack.
48757 CALL PrintCharacter Call PrintCharacter.
48760 POP DE Restore the address of the text from the stack.
48761 INC DE Move on past the text.
48762 EXX Switch to the shadow registers.
48763 EX AF,AF' Fetch the attribute.
48764 LD (HL),A Set the attribute of the last cell.
48765 EXX Switch back to the main registers.
48766 RET Return.
Prev: 48709 Up: Map Next: 48767