The Index Printer

Author(s): Bill Jones
Publication: Update Magazine
Pub Details: Update January 1989
Date: January 1989
Pages: 61

Last issue we gave an index printing program for the TS-2068. This time I was determined to make the QL do it. Actually it turned out to be pretty good, and it has some other applications as well. It could be an “outline printer” or could be used for just about any purpose that one needs to print short lines to a page with TAB control. The program is in pure ole simple BASIC, as I’m not up to the “Super Basic Level” as yet.

One thing you’ve got to be aware of, and that is that the Quill program’s printer set up is such that a LINE FEED is “software furnished” at each line end. So, when using any printing utility such as this one, you must find the little dip switch on the printer that “Turns ON a LINE FEED with each Carriage Return”. That switch must be turned ON. Otherwise, lines will overprint on the same line. Then, when finished and ready to go back to Quill, you can flip the switch off. I’ve put a little dab of the Wife’s red nail polish on that little dip switch so that I wont have to consult the printer manual the next time.

So, “indexer” becomes another little programming tutor for handling such things as INPUT, DIMENSIONING Character Arrays, FOR COUNTERS, OPENing Channel to Printer, PRINT to a TAB position, LINE SPACING, and CLOSEing a Channel. I’m not real sure that the “END FOR n” statement is needed in the three usages of the N counter. The program worked without the END statement but I kept getting a report “PROC INCOMPLETE” thrown on the screen, so I added the END FOR N.

So, key it in and play around with printing under YOUR CONTROL, instead of having to load up a software to do it.

Of course you can add some programming to get out of the split screen if you like, but for simple utilities such as this, I like to see the listing on the left side. Then I can break in with CTRL and SPACE BAR to modify the lines when I want to.

By the way, if your printer is connected to SER 2, just plug it into SER 1. That will be easer than changing the program lines.

I learned a few things while putting this little program together. Normally with the TS-2068 one can use the “dimension of an Array line” as TAB. For example, if a$ is dimensioned A$(10,28) then PRINT A$(n);b$(n) would print b$(n) at TAB 29. Not so with the QL! The QL’s character arrays are filled only with input data, so if you input only 20 characters to A$(n), then that line of the array is only 20 characters in LEN (length). Thus, in line 530 I had to use PRINT #4; TO tb;a$; TO (tb+28);b$ instead of just PRINT #4;TO TB;a$;b$.

Anyway, I had a lot of fun with it and learned quite a bit about the differences in the QL’s syntax for controlling printing positions. At my novice programmer stage with the QL there is quite a bit of need to consult the KEY WORDS section of the manual to find out why the QL keeps giving me the “BAD LINE” report.

A refinement to the program could be to use programming to do the computations for TAB. Example, my printer set up is for 98 character lines, so page center is TAB 49. So lets let pc=49. Then a print line could be: PRINT #4; TO (PC-LEN A$(n)/2;a$. That should CENTER print a$(n) (or would it?). Try it and see.

THE INDEX PRINTER

10 CLS:LIST
20 INPUT "number of index items? ";a:CLS
30 DIM a$(a,28):DIM b$(a,12)
100 CLS:FOR n=1 TO a
110 INPUT "enter index item";a$(n):IF a$(n)="x" THEN LET a$(n)="":LET a=n-1:GO TO 500
120 CLS:INPUT "enter pages";b$(n)
130 NEXT n:END FOR n
500 CLS: INPUT "enter FIRST TAB"; tb
510 OPEN #4,ser1c:BAUD 9600
520 FOR n=1 TO a
530 PRINT #4; TO tb;a$(n);TO (tb+28);b$(n);\
540 NEXT n:END FOR n
550 CLS: INPUT "Nbr of spaces? ";x:IF x>0 THEN FOR n=1 TO x: PRINT #4;\: NEXT n:END FOR n
560 CLS:CLOSE #4:GO TO 10

Indexer is donated to Public Domain if anybody wants it.

————–BJ—————-

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