Disk directory reader in BASIC

From Ninerpedia
Revision as of 08:24, 1 July 2011 by Mizapf (talk | contribs) (Created page with "This TI BASIC program reads the directory of a disk and prints it on the screen. The P flag indicates protection. You can easily expand this program to consider subdirectories; j...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This TI BASIC program reads the directory of a disk and prints it on the screen. The P flag indicates protection. You can easily expand this program to consider subdirectories; just replace the number input in line 170-200 by a direct string input and open the given path name in line 210.

100 CALL CLEAR
110 DIM TYP$(5)
120 TYP$(1)="DIS/FIX"
130 TYP$(2)="DIS/VAR"
140 TYP$(3)="INT/FIX"
150 TYP$(4)="INT/VAR"
160 TYP$(5)="PROGRAM"
170 INPUT "MASTER DISK(1-3)?":A
180 A=INT(A)
190 IF A<1 THEN 170
200 IF A>3 THEN 170
210 OPEN #1:"DSK"&STR$(A)&".",INPUT,RELATIVE,INTERNAL
220 INPUT #1:A$,J,J,K
230 PRINT "DSK";STR$(A);" -DISK NAME= ";A$:"FREE= ";K;"USED= ";J-K
240 PRINT:"FILE NAME  SIZE      TYPE  P":"__________ ______ ________ _"
250 FOR LOOP=1 TO 127
260 INPUT #1:A$,A,J,K
270 IF LEN(A$)=0 THEN 350
280 PRINT:A$;TAB(12);J;TAB(19);TYP$(ABS(A));
290 IF ABS(A)=5 THEN 320
300 B$=" "&STR$(K)
310 PRINT SEG$(B$,LEN(B$)-2,3);
320 IF A>0 THEN 340
330 PRINT TAB(28);"P";
340 NEXT LOOP
350 CLOSE #1