home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nibble Magazine
/
nib42a.dsk
/
MAY.1992
/
MAPPER.bas
< prev
Wrap
BASIC Source File
|
2023-02-26
|
4KB
|
131 lines
10 REM *************************
20 REM * PRODOS DISK MAPPER *
30 REM * by Ernie Alexander *
40 REM * Copyright (C) 1992 *
50 REM * MindCraft Publ. Corp. *
60 REM * Lincoln, MA 01773 *
70 REM *************************
80 DIM M(101,50),N$(101),N(101)
90 D = 1:P = 1:F = 0
100 PRINT CHR$(4)"PREFIX"
110 INPUT X$:N$(D) = X$:D = D +1
120 IF D = 2 THEN N$(1) = LEFT$(X$, LEN(X$) -1)
130 HOME : PRINT "ProDOS MAPPER by Ernie Alexander": PRINT "Copyright (C) 1992, Mindcraft Publishing"
140 VTAB 5: PRINT "Current Prefix: ";X$
150 VTAB 6: PRINT : PRINT "Send map to printer? (Y/N): ";: GET S$
160 IF S$ < >"Y" AND S$ < >"y" AND S$ < >"N" AND S$ < >"n" THEN 150
165 PRINT S$
170 VTAB 7: PRINT : PRINT "Include filenames? (Y/N): ";: GET Y$
180 IF Y$ < >"Y" AND Y$ < >"y" AND Y$ < >"N" AND Y$ < >"n" THEN 170
185 PRINT Y$
190 VTAB 11: PRINT : PRINT "[Reading Directories - Please Wait]"
200 REM
210 REM *** GET NEW PREFIX ***
220 REM
230 X = P:P$ = ""
240 P$ = N$(X) +"/" +P$
250 IF X >1 THEN X = N(X): GOTO 240
260 REM
270 REM *** READ NEW DIRECTORY ***
280 REM
290 PRINT CHR$(4)"OPEN "P$",TDIR"
300 PRINT CHR$(4)"READ "P$
310 INPUT X$,X$,X$
320 INPUT X$: IF X$ = "" THEN 320
330 IF MID$ (X$,1,6) = "BLOCKS" THEN 490
340 IF MID$ (X$,18,1) < >" " THEN F = F +1
350 IF MID$ (X$,18,3) < >"DIR" THEN 320
360 FOR X = 15 TO 1 STEP -1
370 IF MID$ (X$,X +1,1) < >" " THEN 390
380 NEXT X
390 N$(D) = MID$ (X$,2,X):N(D) = P:D = D +1
400 IF D < = 100 THEN 320
410 PRINT CHR$(4)"CLOSE"
420 VTAB 11: PRINT : PRINT "There are more than 100 subdirectories.": PRINT "This map will be incomplete."
430 VTAB 13: PRINT : PRINT "Do you want to continue anyway? (Y/N): ";: GET A$
440 IF A$ < >"Y" AND A$ < >"y" AND A$ < >"N" AND A$ < >"n" THEN 430
450 IF A$ < >"Y" AND A$ < >"y" THEN END
460 VTAB 11: PRINT : FOR Z = 1 TO 3: PRINT " ": NEXT : REM 39SPACES
470 GOTO 560
480 REM
490 REM *** NEXT DIRECTORY ***
500 REM
510 PRINT CHR$(4)"CLOSE"
520 P = P +1: IF P <D THEN 230
530 REM
540 REM *** BUILD DIRECTORY MAP ***
550 REM
560 VTAB 12: PRINT "[Creating Map - Please Wait] ": REM 10 SPACES
570 R = 1:C = 1:M(R,C) = 1
580 P = M(R,C):R = R +1:C = C +1
590 IF R >V THEN V = R
600 IF C >H THEN H = C
610 FOR X = 2 TO D -1
620 IF N(X) < >P THEN 640
630 M(R,C) = X:M(R,0) = C:N(X) = 0: GOTO 580
640 NEXT X
650 C = C -1: IF C = 1 THEN 720
660 FOR X = R TO 1 STEP -1
670 P = M(X,C -1): IF P >0 THEN 610
680 NEXT X
690 REM
700 REM *** NOW FILL IN VERTICAL LINES ***
710 REM
720 V = V -1:H = H -1
730 FOR R = 2 TO V
740 FOR C = 2 TO M(R,0)
750 IF M(R,C) = 0 THEN 800
760 FOR X = R TO 2 STEP -1
770 IF M(X,C -1) < >0 THEN 800
780 M(X,C -1) = -1
790 NEXT X
800 NEXT C,R
810 REM
820 REM *** PRINT MAP ***
830 REM
840 HOME : IF S$ < >"Y" AND S$ < >"y" THEN 870
850 VTAB 12: PRINT "[Printing Map - Please Wait] ": REM 10 SPACES
860 PRINT CHR$(4)"PR#1": REM PRINTER SLOT
870 FOR R = 1 TO V
880 FOR C = 1 TO M(R,0)
890 X = M(R,C)
900 IF X <0 AND M(R,C +1) <1 THEN PRINT " | ";: GOTO 1240: REM 3 & 3 SPACES
910 IF X <0 THEN PRINT " |-->";: GOTO 1240
920 IF X = 0 THEN PRINT SPC( 7);: GOTO 1240
930 PRINT N$(X)
940 IF Y$ < >"Y" AND Y$ < >"y" THEN 1180
950 REM
960 REM *** PRINT ALL FILENAMES ***
970 REM
980 Y = R:Z = C:P$ = ""
990 P$ = N$(M(Y,Z)) +"/" +P$
1000 IF Y = 1 THEN 1040
1010 Z = Z -1
1020 Y = Y -1: IF M(Y,Z) <1 THEN 1020
1030 GOTO 990
1040 PRINT CHR$(4)"PREFIX "P$
1050 PRINT CHR$(4)"OPEN "P$",TDIR"
1060 PRINT CHR$(4)"READ "P$
1070 INPUT X$,X$,X$
1080 INPUT X$: IF X$ = "" AND M(R +1,C) <0 THEN 1080
1090 IF MID$ (X$,1,6) = "BLOCKS" THEN 1170
1100 IF MID$ (X$,18,3) = "DIR" THEN 1080
1110 IF C <2 THEN 1160
1120 FOR Y = 1 TO C -1
1130 IF Y = C -1 AND M(R +1,C) = 0 THEN PRINT SPC( 7);: GOTO 1150
1140 PRINT " | ";
1150 NEXT Y
1160 PRINT MID$ (X$,2,19): GOTO 1080
1170 PRINT CHR$(4)"CLOSE"
1180 IF M(R +1,C) < >0 THEN 1240
1190 IF R = V THEN 1240
1200 FOR X = 1 TO C -2
1210 IF M(R,X) <0 THEN PRINT " | ";
1220 IF M(R,X) = 0 THEN PRINT SPC( 7);
1230 NEXT X: PRINT
1240 NEXT C,R
1250 PRINT : PRINT
1260 PRINT F -D +2;" FILES IN ";D -1;" DIRECTORIES"
1270 PRINT CHR$(4)"PREFIX "N$(1)
1280 PRINT CHR$(4)"PR#0"
1290 END