Prev: BE45 Up: Map Next: BE7F
BE4C: 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 BE4C POP BC Copy the pixel position to BC (using the stack).
BE4D PUSH BC
BE4E CALL CalculateBufferAddress Call CalculateBufferAddress.
BE51 LD L,C Copy it to HL.
BE52 LD H,B
BE53 LD A,(DE) Fetch the attribute of the text.
BE54 EX AF,AF' Keep the attribute in AF'.
BE55 INC DE Move on to the first character.
This entry point is used by the routine at PrintTextSingleColour.
Find the attribute address.
PrintText_Setup BE56 EXX Switch to the shadow registers.
BE57 POP HL Fetch the pixel position.
BE58 PUSH DE Stash the address of the text on the stack.
BE59 CALL CalculateAttributeAddress Call CalculateAttributeAddress.
BE5C LD L,E Copy it to HL.
BE5D LD H,D
BE5E POP DE Restore the address of the text from the stack.
Print each character and set its attribute.
PrintText_NextCharacter BE5F EXX Switch back to the main registers.
BE60 LD A,(DE) Fetch a character of the text.
BE61 BIT 7,A Jump to PrintText_LastCharacter if it is the last.
BE63 JR NZ,PrintText_LastCharacter
BE65 PUSH DE Stash the address of the text on the stack.
BE66 CALL PrintCharacter Call PrintCharacter.
BE69 POP DE Restore the address of the text from the stack.
BE6A INC DE Move on to the next character.
BE6B EXX Switch to the shadow registers.
BE6C EX AF,AF' Fetch the attribute.
BE6D LD (HL),A Set the attribute of the cell.
BE6E INC L Move on to the next cell.
BE6F EX AF,AF' Keep the attribute in AF'.
BE70 JR PrintText_NextCharacter Jump to PrintText_NextCharacter.
Print the last character.
PrintText_LastCharacter BE72 AND %01111111 Keep only bits 0 to 6.
BE74 PUSH DE Stash the address of the text on the stack.
BE75 CALL PrintCharacter Call PrintCharacter.
BE78 POP DE Restore the address of the text from the stack.
BE79 INC DE Move on past the text.
BE7A EXX Switch to the shadow registers.
BE7B EX AF,AF' Fetch the attribute.
BE7C LD (HL),A Set the attribute of the last cell.
BE7D EXX Switch back to the main registers.
BE7E RET Return.
Prev: BE45 Up: Map Next: BE7F