← 9844 Print a font string to the screen Map 98C0 → Move a screen address down one pixel line
987B: Print a font string at double height
Like the single-height printer but double-height (16 pixels tall) – the large status/heading text.
Input
HL screen address of the upper cell of the first character
DE pointer to the string (bit 7 set marks the final character)
C the attribute written to every cell
Output
DE address of the string's final character
print_string_2x 987B PUSH BC Save the attribute and screen address. Build the attribute address in the alternate registers, as the single-height printer does.
987C PUSH HL
987D EXX
987E POP HL
987F LD A,H
9880 AND $18
9882 RRCA
9883 RRCA
9884 RRCA
9885 ADD A,$58
9887 LD H,A
9888 POP BC
9889 EXX
print_string_2x_0 988A PUSH DE Per character: save the string pointer and screen address.
988B PUSH HL
988C LD A,(DE) Read the character and strip the terminator bit.
988D RES 7,A
988F LD L,A
9890 LD H,$00 Point DE at the character's glyph in the font.
9892 ADD HL,HL
9893 ADD HL,HL
9894 ADD HL,HL
9895 LD DE,FONT_BASE
9898 ADD HL,DE
9899 EX DE,HL
989A POP HL
989B LD B,$08
989D PUSH HL
print_string_2x_1 989E LD A,(DE) For each of the 8 glyph rows:
989F LD (HL),A Write the row.
98A0 EX AF,AF'
98A1 CALL screen_down_pixel Step down one pixel line.
98A4 EX AF,AF'
98A5 LD (HL),A Write the same row again – this is what doubles the height.
98A6 CALL screen_down_pixel Step down once more and move to the next glyph row, for all 8 rows. Then switch to the alternate registers for the attribute.
98A9 INC DE
98AA DJNZ print_string_2x_1
98AC EXX
98AD LD (HL),C Write the attribute to this cell and to the cell one row below. Then advance the attribute pointer and the screen address to the next character.
98AE PUSH HL
98AF CALL advance_buffer_row
98B2 LD (HL),C
98B3 POP HL
98B4 INC HL
98B5 EXX
98B6 POP HL
98B7 INC HL
98B8 POP DE Recover the string pointer.
98B9 LD A,(DE) Last character (bit 7 set)? If so return, else loop.
98BA BIT 7,A
98BC RET NZ
98BD INC DE
98BE JR print_string_2x_0
← 9844 Print a font string to the screen Map 98C0 → Move a screen address down one pixel line
Fork me on GitHub