Prev: 30039 Up: Map Next: 30093
30042: Write a line of text into a graphic buffer
Used by the routines at 30156, 30208, 31040 and 63909. Writes a line of text into a graphic buffer (at 60160, 60416 or 60672) and centres it.
Input
DE Buffer address
HL Message address
30042 XOR A Clear the buffer ready for writing
30043 LD B,64
30045 LD (DE),A
30046 INC DE
30047 DJNZ 30045
30049 DEC DE Point DE at the last byte of the buffer
30050 LD C,62 There are 62 pixel columns available for writing in
30052 LD A,(HL) Pick up a character from the message in A
30053 INC HL Move to the next character in the message
30054 AND A Have we reached the end of the message?
30055 JR Z,30079 Jump if so
30057 PUSH HL Save the message pointer
30058 LD L,A Point HL at the pixel width of the bitmap for the character in A
30059 LD H,217
30061 LD A,(HL) Pick up the width in A
30062 LD B,A Transfer the width to B
30063 INC H Point HL at the next font character bitmap byte
30064 LD A,(HL) Pick this up in A
30065 CALL 30097 Insert the font character bitmap byte into the buffer
30068 DEC C Decrease the pixel column count
30069 DJNZ 30063 Jump back until all pixel columns for this letter are done
30071 XOR A A=0 (empty vertical pixel column, i.e. space)
30072 DEC C Decrease the pixel column count
30073 CALL 30097 Insert the space into the buffer
30076 POP HL Restore the message pointer to HL
30077 JR 30052 Jump back to write the next letter from the message
We've finished writing the message. Now centre it.
30079 BIT 7,C Did we use more than 62 pixel columns?
30081 RET NZ Return if so
30082 RR C C holds the number of unused pixel columns; halve this and add one to get the padding
30084 INC C
30085 XOR A Insert an empty pixel column (space)
30086 CALL 30097
30089 DEC C Next column of padding
30090 JR NZ,30085 Jump back until the text has been centred
30092 RET
Prev: 30039 Up: Map Next: 30093