Prt_dir1

Developer(s): Howard Clase
Date: 1991
Type: Diskette
Platform(s): QL
Tags: Printer

Prints the directory of the disk in FLP1_ on a printer connected to SER1, then asks More?; press Y for another directory (change the disk first), any other key to finish, which sends a form feed and closes the printer channel. It is Butch Weinberg’s seven-line Pri_dir rewritten in structured SuperBASIC as Set_up, Main and Finish PROCedures, the starting point of Howard Clase’s series Putting the SUPER into BASIC.

The article also lists two FuNctions to add: Get_Dev$, which offers the default device and lets you type another, and True_dev, which accepts only names such as flp1_ or mdv2_. The article says to put the Get_Dev$ call in line 210, but it belongs in line 220 (the DIR line), as the author corrected in the next episode. The download is the complete Ver 0.1 program; the listing below also has the added lines as printed. Signed (c)1990 H.J.Clase.

Published in Sinc-Link January-February 1991 (Putting the SUPER into BASIC).

Source Code

Prt_dir1 Ver 0.1 (the program in the download)
100 nm$ = "Prt_dir1"
110 REMark hjc 1990.11.03  Ver 0.1
120 Set_up: Main: Finish: STOP
130 REMark ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
140 DEFine PROCedure            Set_up
150   OPEN#3,ser1
160   dev$="flp1_"
170 END DEFine
180 REMark ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
190 DEFine PROCedure              Main
200   LOCal lp
210   REPeat lp
220     DIR#3,dev$
230     PRINT#0,"More?"
240     IF NOT INKEY$(-1)=="y":EXIT lp
250     PRINT#3
260   END REPeat lp
270 END DEFine
280 REMark ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
290 DEFine PROCedure            Finish
300   PRINT#3,CHR$(12): CLOSE#3
310 END DEFine

Change to line 210 (belongs in line 220)
210     DIR#3,Get_Dev$(dev$)

Get_Dev$ and True_dev, added at the end
320 REMark ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
330 DEFine FuNction      Get_Dev$(df$)
340 LOCal dv$,k$,j$,lp
350 CLS: PRINT"Directory of ";df$;" ?"
360 PRINT "Enter, or type new name."
370 REPeat lp
380   k$=INKEY$(-1)
390   IF k$=CHR$(10)
400     dv$=df$
410   ELSE
420     PRINT k$;: INPUT j$: dv$=k$&j$
430   END IF
440   IF True_dev(dv$): EXIT lp
450   BEEP 3000,25:   REMark bad name!
460 END REPeat lp
470 RETurn dv$: END DEFine
500 REMark ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
510 DEFine FuNction       True_dev(d$)
520 LOCal l%,n$,p$,ok%: ok%=0
530 p$="mdv/flp/fdk/ram/hdk"
535 n$="12345678"
540 l%=LEN(d$)
550 IF l%=4: d$=d$&"_": l%=5
560 IF l%=5
570   IF d$(1 TO 3)INSTR(p$)
580     IF d$(4)INSTR n$ AND d$(5)="_"
590       ok%=1
600 END IF: END IF: END IF
610 RETurn ok%: END DEFine

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