Prev: 43297 Up: Map Next: 43386
43299: Print Text
Prints a text record. A text record has four bytes followed by the characters: the x position in pixels, the y position in pixels of the bottom line of the text, the attribute and the number of characters in bits 0-5. Bit 7 of the number of characters selects double height, and bits 6 and 7 together select double height and double width.
print-text
Input
DE The address of the text record
Output
DE The address after the text record
PrintText 43299 EX DE,HL Exchange DE and HL, so that HL is the address of the record.
43300 LD E,(HL) Fetch the x position.
43301 INC HL Move onto the y position.
43302 LD D,(HL) Fetch it.
43303 INC HL Move onto the attribute.
43304 LD A,(HL) Fetch it.
43305 LD (43748),A Store it in the attribute of the rectangle at 43748.
43308 INC HL Move onto the number of characters and the flags.
43309 LD B,(HL) Fetch them.
43310 INC HL Move onto the first character.
43311 XOR A A is 0.
43312 LD (43410),A Store it in the operand of the jump at 43410 to select the normal size.
43315 INC A A is 1.
43316 LD (43747),A Store it as the height of the rectangle at 43747.
43319 LD A,B Fetch the number of characters.
43320 AND %00111111 Keep the number of characters.
43322 LD (43746),A Store it as the width of the rectangle at AttributeRectangle.
43325 BIT 7,B Jump to PrintText_Attributes if bit 7, the flag for double height, is reset.
43327 JR Z,PrintText_Attributes
43329 BIT 6,B Jump to PrintText_Double if bit 6, the flag for double width, is set.
43331 JR NZ,PrintText_Double
43333 LD A,12 Set the distance to jump to 12...
43335 LD (43410),A ...to select double height.
43338 LD A,2 Set the height of the rectangle to 2.
43340 LD (43747),A Store it.
43343 JR PrintText_Attributes Jump to PrintText_Attributes.
PrintText_Double 43345 LD A,30 Set the distance to jump to 30...
43347 LD (43410),A ...to select double height and width.
43350 LD A,2 Set the height of the rectangle to 2.
43352 LD (43747),A Store it.
43355 LD A,(43746) Fetch the width of the rectangle.
43358 ADD A,A Double it.
43359 LD (43746),A Store it.
PrintText_Attributes 43362 EX DE,HL Exchange DE and HL, so that DE is the address of the first character and HL is the position.
43363 PUSH BC Save the number of characters.
43364 PUSH DE Save the address of the first character.
43365 CALL FillScratchRectangle Call FillScratchRectangle to set the attributes.
43368 POP DE Restore the address of the first character.
43369 POP BC Restore the number of characters.
43370 CALL GetScreenAddress Convert the pixel position into a screen address.
43373 LD A,B Fetch the number of characters.
43374 AND %00111111 Keep the number of characters.
43376 LD B,A Store it in B.
PrintText_Character 43377 PUSH BC Save the number of characters.
43378 CALL PrintCharacter Print a character.
43381 POP BC Restore the number of characters.
43382 INC DE Move onto the next character.
43383 DJNZ PrintText_Character Jump back until all of the characters have been printed.
43385 RET Return.
Prev: 43297 Up: Map Next: 43386