Printer Set-Up

See all articles from Update July 1989
Author(s): Walt Horais
Publication: Update Magazine
Pub Details: Update July 1989
Date: July 1989
Pages: 37-41

Introduction

Many programs have been written for setting up a printer. I find this program useful for printing basic files in the character setting desired with the margin/line format I choose.

I use this program primarily for printing basic files. I use it a lot for printing downloaded files and Easyplex messages from Compuserve. The program uses a different type of menu which you may find interesting. It is a basic version of the “Pull-Down” menu structure. I use the program quite often with QUILL. Use caution, however in setting the margin/line functions so they do not conflict with the same functions in QUILL. With minor program changes, this program can print multiple copies.

Program Operation

When the program is loaded and run, you are presented with a menu of four margin/line choices, followed by six choices of character settings. The top menu item is highlighted.

The up and down cursor keys select a menu item which will be highlighted. To initiate action on this selection, press <ENTER>. Additional instructions will be presented below the menu box.

In the case of margin/line functions, enter the value desired, press <ENTER> and the value entered will be posted opposite the menu item. For the character setting choice, press <ENTER>, and the instruction <F1>-“ON” <F2>-“OFF” is displayed below the menu box. Selecting the desired key will post its function opposite the menu item. (Note: “OFF” is a blank). The up and down cursor keys can be used to change or correct any selection.

After the desired margin/line and character settings are selected, press <F5> to send the commands to the printer. (printer is assumed on). A further message will appear below the menu box stating: “Printer codes have been entered as selected”, ” Do you wish to print a file ? (y/n)”. Selecting “y” will produce a request of: “Enter device ” (enter mdv or flp desired. Note the “_” after the device is not needed). After entering the device, the request of: ” Enter file name ” appears. After entering the file name, the file will be printed with the margin/line and character settings selected. When the printing is complete, a message will state: “Printing complete (re-run for further use)”.

If “N” is selected when asked if you desire to print a file, the message: “PROGRAM TERMINATED” is displayed, followed in two seconds by the restoration of the program windows to the turn-on default windows and the clearing of the program. The program is not “crash proof”. Should this occur, just re-run.

The program listing contains information on the functions of each listing block; however, additional information is presented below:

Line          Function

5 to 80       Program initialization, sets windows,
              variables, and prints menu.

105 to 180    Provides menu selection by changing
              highlighted menu item.

205 to 275    Toggle functions ("ON" -"OFF") for
              character settings.

305 to 365    Printer character commands.
              Note. These codes are for a QL printer.
              Change to suit your printer.

405 to 455    Message commands and input requests.

505 to 530    Data (Menu items).

605 to 665    Procedures. (These were used to make the
              listing less cluttered).

I have used this PRINTER SET-UP program for some time, and I find it quite useful. I would appreciate any comments, either to my CIS number contained in the program, or to my address: [address omitted]. Please include a SASE if a reply is requested.

5 REMark ------------------------------------------------
10 REMark ! Printer Set-up Program !
15 REMark ! By Walt Horais - CIS #71641,664 !
20 REMark ------------------------------------------------
25 REMark ########## Initialization ##########
30 CLEAR: RESTORE : WINDOW 512,202,0,0: PAPER 0: BORDER 1,2: CLS
35 OPEN #3,ser: PRINT #3,CHR$(27);"@": PRINT #3,CHR$(24): CLOSE #3
40 STRIP 0: AT 1,29: INK 6: PRINT "PRINTER FORMAT"
45 DIM a$(10,26): x=1: y=3: p=1: rm=0: lm=0: pg=0: sk=0: e=0
50 i=0: b=0: h=0: pr=0: ds=0: g=0: k=0: l=0: r=0
55 READ a$(1), a$(2), a$(3), a$(4), a$(5)
60 READ a$(6), a$(7), a$(8), a$(9), a$(10): STRIP 6: INK 0
65 AT 3,23: PRINT a$(1): STRIP 4: AT 4,23: PRINT a$(2)
70 AT 5,23: PRINT a$(3): AT 6,23: PRINT a$(4): AT 7,23: PRINT a$(5)
75 AT 8,23: PRINT a$(6): AT 9,23: PRINT a$(7): AT 10,23: PRINT a$(8)
80 AT 11,23: PRINT a$(9): AT 12,23: PRINT a$(10)
105 REMark ########## Menu Selection ##########
110 REPeat loop
115 LET z=CODE(INKEY$(-1)): SELect ON z
120 =208: IF x=1
125 GO TO 110
130 ELSE : x=x-1: y=y-1: p=p-1: STRIP 6: AT y,23
135 PRINT a$(x): STRIP 4: AT y+1,23: PRINT a$(x+1)
140 =216: IF x=10
145 STRIP 6: AT y,23: PRINT a$(x)
150 ELSE : x=x+1: y=y+1: p=p+1: STRIP 6: AT y,23
155 PRINT a$(x): STRIP 4: AT y-1,23: PRINT a$(x-1)
160 = 10: IF p=1: flip: clr: pl: INPUT"Enter Right Margin ";r: IF r>0: rm=1:clr: pu: PRINT r: flop
165 IF p=2: flip: clr: pl: INPUT"Enter Left Margin ";l: IF l>0: lm=1: clr: pu: PRINT l: flop
170 IF p=3: flip: clr: pl: INPUT"Enter Page Length ";g: IF g>0: pg=1: clr: pu: PRINT g: flop
175 IF p=4: flip: clr: pl: INPUT" enter Skip Lines ";k: IF k >0: sk=1: clr: pu: PRINT k: flop
180 IF p=5 OR p=6 OR p=7 OR p=8 OR p=9 OR p=10: flip: pl: info: flop
205 REMark ########## Toggle Function ##########
210 =232: num: flip: clr: mark: c=1: flop: REMark <F1>-"ON"
215 IF p=5 AND c=1: e=1
220 IF p=6 AND c=1: i=1
225 IF p=7 AND c=1: b=1
230 IF p=8 AND c=1: h=1
235 IF p=9 AND c=1: pr=1
240 IF p=10 AND c=1: ds=1
245 =236: num: flip: clr: rub: c=0: flop: REMark <F2>-"OFF"
250 IF p=5 AND c=0: e=0
255 IF p=6 AND c=0: i=0
260 IF p=7 AND c=0: b=0
265 IF p=8 AND c=0: h=0
270 IF p=9 AND c=0: pr=0
275 IF p=10 AND c=0: ds=0
305 REMark ########## Code Selection ##########
310 =248: OPEN #3,ser
315 IF rm=1: PRINT #3, CHR$(27);"Q";CHR$(r);
320 IF lm=1: PRINT #3, CHR$(27);"l";CHR$(l);
325 IF pg=1: PRINT #3, CHR$(27);"C";CHR$(g);
330 IF sk=1: PRINT #3, CHR$(27);"N";CHR$(k);
335 IF e=1: PRINT #3, CHR$(27);"M";
340 IF i=1: PRINT #3, CHR$(27);"4";
345 IF b=1: PRINT #3, CHR$(27);"E";
350 IF h=1: PRINT #3, CHR$(27);"x1";
355 IF pr=1: PRINT #3, CHR$(27);"p1";
360 IF ds=1: PRINT #3, CHR$(27);"G";
365 CLOSE #3
405 REMark ########## Commands ##########
410 AT 15,15: PRINT " Printer codes have been entered as selected "
415 AT 17,10: PRINT" Do you wish to print a file ? (y/n) "
420 =89,121: STRIP 0: AT 17,18: PRINT " "
425 AT 15,15: PRINT " "
430 AT 17,23: INK 6: INPUT "Enter Device: ";dev$
435 AT 18,23: INPUT "Enter file name: ";fil$
440 COPY_N dev$&"_"&fil$ TO ser1
445 CLS: AT 9,20: PRINT"Printing complete (re-run for further use)"
446 BEEP 1500,25: EXIT loop
450 =78,110: CLS: AT 9,20: CSIZE 2,1: PRINT " Program Terminated "
451 BEEP 1500,25: CSIZE 0,0: PAUSE 120
452 WINDOW #2,256,202,0,0: PAPER #2,6: INK #2,2
453 BORDER 1,6,0: CLS: WINDOW 256,202,256,0: PAPER 2
454 INK 6: BORDER 1,6,0: CLS: NEW
455 END IF : END SELect : END REPeat loop
505 REMark ########## Data ##########
510 DATA " Right Margin (10-80)"," Left Margin ( 0-70)"
515 DATA " Page Length ( -66)"," Skip Lines "
520 DATA " Elite Character "," Italic Character "
525 DATA " Bold Character "," High Quality "
530 DATA " Proportional "," Double Strike "
605 REMark ########## Procedures ##########
610 DEFine PROCedure flip: STRIP 0: INK 6: END DEFine
615 DEFine PROCedure flop: STRIP 4: INK 0: END DEFine
620 DEFine PROCedure clr: pl: PRINT" "
625 END DEFine
630 DEFine PROCedure mark: pu: PRINT'ON': c=1: END DEFine
635 DEFine PROCedure rub: pu: PRINT " ": c=0: END DEFine
640 DEFine PROCedure pu: AT p+2,53: END DEFine
645 DEFine PROCedure pl: AT 14,23: END DEFine
650 DEFine PROCedure info: PRINT'<F1>-"ON" <F2>-"OFF" '
655 END DEFine
660 DEFine PROCedure num: IF p=5 OR p=6 OR p=7 OR p=8 OR p=9 OR p=10
665 END DEFine

LISTSCAN

Introduction

I am “well over 40” years of age, and often when writing a basic program, I find that my memory is a bit hazy on just how to write a desired program segment. Often, I have written that segment before, and I examine program listings to find it.

The “list” command on the QL is not the easiest to use when examining a listing for a specific segment. When you see the segment scroll by, if you can note its listing numbers, you can list those numbers to a printer. I desired a more efficient way to examine and print segments of a program listing; this prompted me to write the LISTSCAN program.

I attempt to write programs in segments of 100 line numbers, in 5 digit increments (20 lines will fit nicely on the QL display). This results in a program segment that is easy to display and print. The LISTSCAN program is written in basic, located at line number 30,000. This enables quite lengthy programs to be merged and examined.

Program Operation

Once the LISTSCAN program is loaded and run, a window will be displayed with the request: “Enter device ” (enter mdv or flp). Note the “_” after the device is not needed. After entering the device, a request of “Enter file name ” is displayed. After entering the file name, the program starts. BE PATIENT ! The program is slow, particularly on long programs. After a program to be examined is merged, the LISTSCAN program determines the lowest line number and the highest line number. This is done to handle different starting line numbers, and stop the program from “running away” after the highest line number.

Finally, the first block of listing is displayed, with a menu stating: “<f>orward <b>ack <p>rint <n>ew file and <q>uit”. <f>orward and <b>ack move the displayed listing block by 100 line numbers. <p>rint will print a displayed listing to your printer. <n>ew file is just that; and you are returned to the initial screen request of “Enter device” and “Enter file name”. <q>uit restores the program windows to the turn-on default windows and clears the program.

Upon reaching the highest line number display, attempts to continue higher will result in a beep and the message: “Highest display”, with a return to the highest number display. The same sequence occurs at the lowest display except the message states: “Lowest display”. The program is not “crash proof”, but if it does crash while examining a listing, it can be re-run. But before doing so, all listing lines of the program being examined must be deleted. (dline first to last, followed by run works nicely).

Comments

The program listing contains information on the function of each listing block; however, additional information is presented below:

Line              Function

30005 to 30090    Program initialization, sets windows, defines
                  device and file names, determines lowest and
                  highest line numbers.

30105 to 30190    Prints menu, selects higher or lower displays,
                  (<f>orward or <b>ack), sounds alert and prints
                  display limits.

30205 to 30240    Menu commands of: <p>rint, <n>ew file, <q>uit.

30305 to 30330    Procedures (used to make the program less
                  cluttered).

I hope you will find this program useful. I would appreciate any comments, either to my CIS number contained in the program, or to my address: [address omitted]. Please include a SASE if a reply is requested.

30005 REMark ------------------------------------------------
30010 REMark ! Listing Scan Program !
30015 REMark ! By Walt Horais - CIS # 71641,664 !
30020 REMark ------------------------------------------------
30025 REMark ########## Initialization ##########
30030 DIM dev$(5): DIM fil$(15): WINDOW 512,256,0,0: PAPER 0: CLS
30045 OPEN #4, scr_512x202a0,0: PAPER #4,4: INK #4,0
30050 BORDER #4,1,6: CLS #4
30055 AT 8,20: PAPER 4: INK 0: INPUT,"Enter device: ";dev$
30060 AT 10,20: INPUT,"Enter file name: ";fil$
30065 MERGE dev$&"_"&fil$
30070 OPEN #3, dev$&"_"&fil$: INPUT #3, first: f=first
30075 REPeat loop
30080 IF EOF (#3) THEN EXIT loop
30085 INPUT #3, last: l=last
30090 END REPeat loop: CLOSE #3
30105 REMark ########## Display List ##########
30110 OPEN #5, scr_512x12a0x204: PAPER #5,0: INK #5,6
30115 BORDER #5,1,6: CLS #5
30120 AT #5,0,16: PRINT #5," <f>orward <b>ack <p>rint "
30125 AT #5,0,44: PRINT #5," <n>ew file <q>uit "
30130 CLS #4: dsp
30135 REPeat loop
30140 z=CODE(INKEY$(-1)): SELect ON z
30145 =70,102: CLS #4
30150 IF f+95>l
30155 snd: PRINT #4," Highest Display ": rst: GO TO 30135
30160 ELSE
30165 f=f+95: dsp
30170 = 66,98: CLS #4
30175 IF f=first
30180 snd: PRINT #4," Lowest Display ": rst: PAPER #4,4
30185 ELSE
30190 f=f-95: dsp
30205 REMark ########## Other Commands ##########
30210 =80,112: OPEN #3,ser: LIST #3, f TO f+95: CLOSE #3
30215 =78,110: WINDOW 512,256,0,0: PAPER 0: PAPER #2,0:INK #2,0: CLS
30220 DLINE first TO last: CLEAR: RUN
30225 =81,113: WINDOW 256,202,0,0: PAPER #2,6: INK #2,2
30230 BORDER 1,6,0: CLS: WINDOW 256,202,256,0: PAPER 2
30235 INK 6: BORDER 1,6,0: CLS: NEW
30240 END IF : END SELect : END REPeat loop: NEW
30305 REMark ########## Procedures ##########
30310 DEFine PROCedure snd: BEEP 2000,35: AT #4,18,30: PAPER #4,2
30315 END DEFine
30320 DEFine PROCedure rst: PAUSE 60: PAPER #4,4: CLS #4
30325 LIST #4, f TO f+95: END DEFine
30330 DEFine PROCedure dsp: LIST #4, f TO f+95: END DEFine

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