Skool Daze Routines
30042: Write line of text into graphic buffer
Used by the routines at 30156, 30208, 31040 and 63909.
DE Graphic buffer address
HL Address of message to write
30042 XOR A A=0 (empty pixel column)
30043 LD B,64 Clear a line in the buffer ready for writing
30045 LD (DE),A
30046 INC DE
30047 DJNZ 30045
30049 DEC DE
30050 LD C,62 There are 62 pixel columns available for writing in
30052 LD A,(HL) Pick up an ASCII code in A
30053 INC HL Move to the next letter in the message
30054 AND A Have we reached the end of the message?
30055 JR Z,30079 Jump if so
30057 PUSH HL
30058 LD L,A L=ASCII code of letter from message
30059 LD H,217 Point HL at the pixel width of the font character bitmap
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
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
30090 JR NZ,30085 Jump back until the text has been centred
30092 RET