Prev: A0DB Up: Map Next: A149
A115: Print a string
Prints one string record and returns DE pointing at the next, so a list of strings can be printed by calling this again. The record is: x in pixels, y in pixels (the pixel line the characters' bottom rows go on), an attribute byte, a character count, and that many character codes. Bit 7 of the attribute byte asks for double size (print_char_double); the other seven bits are the colour, so a string can never FLASH. Character n's glyph is the seven bytes at font plus 7n, bottom row first.
Input
DE The string record
Output
DE The byte after it
print_string A115 XOR A Normal size: point the character printer's JR (at the end of print_char) at the normal-size loop
A116 LD ($A0CA),A
A119 LD A,(DE) The x and y coordinates
A11A LD L,A
A11B INC DE
A11C LD A,(DE)
A11D LD H,A
A11E INC DE
A11F PUSH DE Keep the pointer and coordinates; HL becomes the screen address
A120 PUSH HL
A121 CALL pixel_to_screen
A124 EXX In the other register set: HL' the attribute address, DE' the pointer to the attribute byte
A125 POP HL
A126 CALL pixel_to_attribute
A129 POP DE
A12A LD A,(DE) Bit 7 of the attribute byte: double size?
A12B BIT 7,A
A12D JR Z,print_string_0
A12F LD A,$10 Yes: patch the JR to reach print_char_double, strip bit 7, and keep DE' at 32 to step an attribute row up
A131 LD ($A0CA),A
A134 LD A,(DE)
A135 AND $7F
A137 LD DE,$0020
print_string_0 A13A LD B,A The colour in B'
A13B EXX Back in the main set: B is the character count
A13C INC DE
A13D LD A,(DE)
A13E LD B,A
print_string_1 A13F PUSH BC Print each character (print_char steps HL along)
A140 INC DE
A141 CALL print_char
A144 POP BC
A145 DJNZ print_string_1
A147 INC DE Point DE past the string
A148 RET
Prev: A0DB Up: Map Next: A149