Font_Printer

Developer(s): Al Boehm
Date: 1989
Type: Diskette
Platform(s): QL
Tags: Printer

Prints the Sinclair QL’s screen-font characters on an Epson-compatible printer as bit-image graphics: it turns each character’s horizontal font bytes into the vertical slices a dot-matrix printer needs and sends them with ESC K (draft) or ESC L (emphasized, each slice twice). As listed it prints characters 31 to 110 of the default font.

Line 110 holds the default font address for the JSU ROM; line 120 gives the MG ROM address and the article gives the JS ROM’s and a way to find any font. The procedures init_printer_font and the function c$ are for use in other programs, for example to print special Quill characters.

Published in the BCS Sinclair-Timex User Group Newsletter September/October 1989 (Printing QL Fonts).

Source Code

10 REMark Font_Printer 18 Aug 1989 by A.Boehm
100 OPEN #3,ser1:REMark printer channel
110 address=44514:REMark JSU rom default font
120 REMark address=44512:REMark MG rom default font
130 type =1:REMark change 1 to 0 for draft
140 REMark print 80 characters
150 FOR l=31 TO 110
160 invert_font address,l
170 IF type=0 THEN draft:ELSE emphasized
180 END FOR l
190 PRINT#3:REMark sends carriage return so line feed is printed
200 CLOSE#3:STOP
210 REMark ===========================
300 DEFine PROCedure invert_font (font_at,chr)
310 DIM v(8)
320 first=PEEK(font_at)
330 last=first+PEEK(font_at+1)
340 IF chr<first OR chr>last THEN PRINT 'Character ';chr;' not in font range ';first;' to ';last
350 chr_at=font_at+2+9*(chr-first)
360 FOR i=0 TO 7
370 hi=PEEK(chr_at+i)
380 m2=2^(7-i)
390 FOR j=1 TO 7
400 IF hi&&2^(7-j) THEN v(j)=v(j)||m2
410 END FOR j
420 END FOR i
430 END DEFine :REMark ===============
500 DEFine PROCedure draft
510 p$=""
520 FOR i=1 TO 6:p$=p$&CHR$(v(i))
530 REMark ESC K 6 0 tells printer to expect  6 single-density graphic bytes
540 PRINT #3,CHR$(27);'K';CHR$(6);CHR$(0);p$;
550 END DEFine :REMark ===============
600 DEFine PROCedure emphasized
610 REMark doubles each vertical slice to get 12 slices
620 p$=""
630 FOR i=1 TO 6:p$=p$&CHR$(v(i))&CHR$(v(i))
640 REMark ESC L 12 0 tells printer to expect 12 double density graphic bytes
650 PRINT #3,CHR$(27);'L';CHR$(12);CHR$(0);p$;
660 END DEFine :REMark ===============
700 DEFine PROCedure init_printer_font (font_at)
710 first=PEEK(font_at)
720 last=first+PEEK(font_at+1)
730 DIM font$(last,11):REMark 12 counting 0 for double density
740 FOR n=first TO last
750 invert_font font_at,n
760 g$=""
770 FOR m=1 TO 6:g$=g$&CHR$(v(m))&CHR$(v(m))
780 font$(n)=g$
790 END FOR n
800 END DEFine :REMark ===============
900 DEFine FuNction c$(chr)
915 REMark returns printer sequence for graphic printing of character chr
920 RETurn CHR$(27)&'L'&CHR$(12)&CHR$(0)&font$(chr)
930 END DEFine :REMark ===============

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.