Prev: BB9D Up: Map Next: BBEB
BBB1: Print a string whose first byte is its colour
Used by the routines at COLOUR_PANEL and GAME_ENDED.
As PRINT_TEXT_SINGLE_COLOUR, but the colour is the string's own first byte. The panel's "LIGHT YEARS" (COLOUR_PANEL, which writes that byte first) and the summary's rating (GAME_ENDED, RATING_POOR) are printed with it. Knight Lore's print_text; Pentagram has these bytes too, but nothing reaches them there.
TEXT_ATTR_ADDR, the entry after the colour is in A', takes the position off the stack: in the alternate registers HL' becomes the attribute address of the first cell, while DE' is kept, since the list printer (DISPLAY_MENU) walks its colours with it. Then each character is drawn into the buffer by PRINT_CHAR, which leaves HL one cell to the right, and its cell in the attribute file is given the colour.
Input
HL the position: L = x, H = y, in pixels, y counting up from the bottom
DE the colour byte, then the string, bit 7 set on its last character
Output
DE the byte after the string
PRINT_TEXT BBB1 PUSH HL the text font
BBB2 LD HL,$6188
BBB5 LD (FONT_BASE),HL
BBB8 POP BC BC = the position, left on the stack; HL = its address in the buffer
BBB9 PUSH BC
BBBA CALL CALC_VIDBUF_ADDR
BBBD LD L,C
BBBE LD H,B
BBBF LD A,(DE) the colour, from the string's first byte, into A'
BBC0 EX AF,AF'
BBC1 INC DE
This entry point is used by the routine at PRINT_TEXT_SINGLE_COLOUR.
TEXT_ATTR_ADDR BBC2 EXX take the position off the stack into HL'
BBC3 POP HL
BBC4 PUSH DE HL' = the attribute address of the position (CALC_ATTRIB_ADDR); DE' kept
BBC5 CALL CALC_ATTRIB_ADDR
BBC8 LD L,E
BBC9 LD H,D
BBCA POP DE
PRINT_TEXT_CHAR BBCB EXX bit 7 marks the last character
BBCC LD A,(DE)
BBCD BIT 7,A
BBCF JR NZ,PRINT_TEXT_LAST
BBD1 PUSH DE draw it, and move on in the string
BBD2 CALL PRINT_CHAR
BBD5 POP DE
BBD6 INC DE
BBD7 EXX colour its cell, one cell right, and loop
BBD8 EX AF,AF'
BBD9 LD (HL),A
BBDA INC L
BBDB EX AF,AF'
BBDC JR PRINT_TEXT_CHAR
PRINT_TEXT_LAST BBDE AND $7F the last character, without its end marker; DE ends past the string
BBE0 PUSH DE
BBE1 CALL PRINT_CHAR
BBE4 POP DE
BBE5 INC DE
BBE6 EXX colour its cell
BBE7 EX AF,AF'
BBE8 LD (HL),A
BBE9 EXX
BBEA RET
The PUSH DE and POP DE round each call of PRINT_CHAR are not needed: it keeps DE itself.
Prev: BB9D Up: Map Next: BBEB