10 '            * * * * * * * * * * * * *
20 '            *  Program by Kim Watt  *
30 '            * Breeze Computing Inc. *
40 '            *     P.O.  Box 1013    *
50 '            * Berkley, Mich.  48072 *
60 '            *    (313) 288-9422     *
70 '            * * * * * * * * * * * * *
80 '
90 '  This program will allow BASIC to read a directory
100 '           and print the filenames.
110 '
120 CLEAR2000:DEFSTRA-D
130 DIMA(7),B(7),C(7),D(7)
140 OPEN "R",1,"DIR/SYS"  '* open directory in random mode
150 FORE=0TO7   '* setup loop for 8 entries/sector
160 FIELD1,E*32ASD(E),5ASA(E),8ASB(E),3AS C(E),16ASD1(E)
170 NEXTE
180 ' setup files to be read into arrays
190 FORE=3TO10:ONERRORGOTO200:GET1,E  '* read the directory sectors
200 RESUME210     '* now we have captured the error message
210 ONERRORGOTO0   '* in case we hit another error
220 FORE1=0TO7     '* print 8 files / sector
230 GOSUB310   '* prints all files
240 '  for other files use line 2230 as follows
250 'IFNOTASC(A(E1))AND64THENGOSUB310  '* non-system files only
260 'IFASC(A(E1))AND64THENGOSUB310  '*  system files only
270 'IFC(E1)="BAS"THENGOSUB310   '* prints /BAS files only
280 'IFC(E1)="CMD"ORC(E1)="BAS"THENGOSUB310 '* prints all /BAS and /CMD files
285 'IFLEFT$(B(E1),1)="D"THENGOSUB310   '* prints files that start with the letter D only
287 'IFLEFT$(B(E1),1)="D"ANDNOTASC(A(E1))AND64THENGOSUB310   '*  prints non-system files that start with the letter D
290 NEXTE1,E    '* finish all 8 sectors
300 CLOSE:END   '* close the directory
310 IFASC(A(E1))AND16THENIFNOTASC(A(E1))AND128THEN320ELSERETURNELSERETURN    '* make sure the file is active & not an extension
320 E2=INSTR(B(E1)," "):IFE2<8ANDE2>0THENPRINTLEFT$(B(E1),E2-1);ELSEPRINTB(E1);
330 IFASC(C(E1))<>32THENPRINT"/"C(E1),ELSEPRINT,
340 RETURN
