| Routines

755A: Write a line of text into a graphic buffer

Used by the routines at 75CC, 7600, 7940 and F9A5. Writes a line of text into a graphic buffer (at EB00, EC00 or ED00) and centres it.
Input
DE | Buffer address
HL | Message address
755A | XOR A | Clear the buffer ready for writing
755B | LD B,$40
755D | LD (DE),A
755E | INC DE
755F | DJNZ $755D
7561 | DEC DE | Point DE at the last byte of the buffer
7562 | LD C,$3E | There are 62 pixel columns available for writing in
7564 | LD A,(HL) | Pick up a character from the message in A
7565 | INC HL | Move to the next character in the message
7566 | AND A | Have we reached the end of the message?
7567 | JR Z,$757F | Jump if so
7569 | PUSH HL | Save the message pointer
756A | LD L,A | Point HL at the pixel width of the bitmap for the character in A
756B | LD H,$D9
756D | LD A,(HL) | Pick up the width in A
756E | LD B,A | Transfer the width to B
756F | INC H | Point HL at the next font character bitmap byte
7570 | LD A,(HL) | Pick this up in A
7571 | CALL $7591 | Insert the font character bitmap byte into the buffer
7574 | DEC C | Decrease the pixel column count
7575 | DJNZ $756F | Jump back until all pixel columns for this letter are done
7577 | XOR A | A=0 (empty vertical pixel column, i.e. space)
7578 | DEC C | Decrease the pixel column count
7579 | CALL $7591 | Insert the space into the buffer
757C | POP HL | Restore the message pointer to HL
757D | JR $7564 | Jump back to write the next letter from the message
We've finished writing the message. Now centre it.
757F | BIT 7,C | Did we use more than 62 pixel columns?
7581 | RET NZ | Return if so
7582 | RR C | C holds the number of unused pixel columns; halve this and add one to get the padding
7584 | INC C
7585 | XOR A | Insert an empty pixel column (space)
7586 | CALL $7591
7589 | DEC C | Next column of padding
758A | JR NZ,$7585 | Jump back until the text has been centred
758C | RET |