Prev: A0DB Up: Map Next: A149
A115: Print Text
Prints a line of text. The text is held in a record made of the horizontal pixel position, the vertical pixel position, the attribute, the number of characters and then the characters. Bit 7 of the attribute makes the text wide.
printed-title
Input
DE Address of the text record
Output
DE Address of the byte after the record
PrintText A115 XOR A Select normal characters.
A116 LD ($A0CA),A Change the instruction at PrintCharacter_Mode to match.
A119 LD A,(DE) Fetch the horizontal position.
A11A LD L,A
A11B INC DE Move on to the vertical position.
A11C LD A,(DE) Fetch the vertical position.
A11D LD H,A Move on to the attribute.
A11E INC DE Save the address of the attribute.
A11F PUSH DE Save the position.
A120 PUSH HL Find the screen address.
A121 CALL GetScreenAddress
A124 EXX Switch to the attribute registers.
A125 POP HL Restore the position.
A126 CALL AttributeAddress Find the attribute address.
A129 POP DE Restore the address of the attribute.
A12A LD A,(DE) Fetch the attribute.
A12B BIT 7,A Jump to PrintText_Attribute if the text is not wide.
A12D JR Z,PrintText_Attribute
A12F LD A,$10 Select wide characters.
A131 LD ($A0CA),A Change the instruction at PrintCharacter_Mode to match.
A134 LD A,(DE) Fetch the attribute again.
A135 AND %01111111 Remove the flag.
A137 LD DE,$0020 Set the offset between rows of attributes.
PrintText_Attribute A13A LD B,A Store the attribute.
A13B EXX Switch back to the screen registers.
A13C INC DE Move on to the number of characters.
A13D LD A,(DE) Fetch it.
A13E LD B,A Store it in B.
PrintText_Loop A13F PUSH BC Save the number of characters.
A140 INC DE Move on to the next character.
A141 CALL PrintCharacter Print the character.
A144 POP BC Restore the number of characters.
A145 DJNZ PrintText_Loop Loop back to PrintText_Loop for each character.
A147 INC DE Move on to the byte after the record.
A148 RET Return.
Prev: A0DB Up: Map Next: A149