Compucolor.org – Virtual Media

Listing of file='INDEX2.BAS;01' on disk='vmedia/chip_63-sector.ccvf'

100 REM  ******* DISK  DIRECTORY  INDEX *******
110 REM                V 2.0 
120 REM  THIS PROGRAM SAVES DIRECTORY INFORMATION IN RND FILES
130 REM  FOR LATER RECALL
140 REM  BY GREG HUBBARD MODIFIED BY  TONY LEE 14/3/82
145 REM  FOR 2 DISK DRIVES
150
180 CLEAR 100
190 S= 0:I= 0:Y= 0:X= 0:MX$= "":MZ$= ""
200 NA$= "":NO$= "":A$= "":O$= "":ZZ$= "":ZB$= "":DN$= "":PN$= "":PS$= ""
210 PLOT 6,4,12
220 PLOT 3,4,5:PRINT "nu en cf b~    nu en {d {e tf en tu {d |~  en pb nu {e |~"
230 PLOT 3,4,6:PRINT "lw l gd b|    lw l a| l vi  a vw a| b   l as lw l ~|"
240 PLOT 3,10,10:PRINT "1. VIEW INDEX"
250 PLOT 3,10,12:PRINT "2. UPDATE INDEX"
260 PLOT 3,10,14:PRINT "3. PRINT ENTIRE INDEX"
270 PLOT 3,10,16:PRINT "4. PRINT SPECIFIED INDEX"
280 PLOT 3,10,18:PRINT "5. END PROGRAM"
290 PLOT 3,8,20:INPUT "ENTER YOUR SELECTION > ";S
300 FILE "T",1410
310 FILE "R",1,"INDEX",13:GET 1,1;LR
320 S= INT (S):IF S< 1OR S> 4THEN PLOT 28,11:GOTO 290
330 ON SGOTO 350,640,1010,890,840
340 REM
350 REM 	*** INSPECT INDEX ***
360 REM
370 PLOT 6,7,12
380 PRINT "DISK NO."TAB( 10)"DISK NAME"TAB( 30)"DISK NO."TAB( 40)"DISK NAME"
390 PRINT
400 FOR I= 2TO INT (LR/ 2)+ 1
410 GET 1,I;NO$[5],NA$[11]
420 PRINT NO$TAB( 10)NA$
430 NEXT I
440 Y= 2
450 FOR I= ITO LR
460 GET 1,I;NO$[5],NA$[11]
470 PLOT 3,30,Y:PRINT NO$:PLOT 3,40,Y:PRINT NA$
480 Y= Y+ 1
490 NEXT I
500 FILE "C",1
510 REM
520 REM 	*** PRINT DIR ***
530 REM
540 PRINT :PRINT ""
550 IF MZ$= "X"GOTO 920
560 PRINT "WHICH DIRECTORY DO YOU WISH TO SEE ?"
570 INPUT "ENTER DISK NUMBER ";NO$
580 GOSUB 1750
590 PRINT
600 INPUT "LIKE TO SEE ANOTHER ? ";ZB$
610 IF LEFT$ (ZB$,1)= "Y"THEN FILE "R",1,"INDEX",13:GOTO 350
620 GOTO 180
630 REM
640 REM 	*** UPDATE INDEX ***
650 REM
660 PLOT 12
670 INPUT "ENTER DISK NUMBER (EG. 001A)  ";NO$
680 INPUT "ENTER DISK NAME (EG. SAMPLER) ";NA$
690 FOR I= 1TO LR
700 GET 1,I;O$[5],A$[11]
710 IF LEFT$ (O$,4)= LEFT$ (NO$,4)THEN GOTO 1340
720 NEXT I
730 PUT 1,1;LR+ 1
740 PUT 1,I;NO$[5],NA$[11]
750 FILE "C",1
760 PRINT :PRINT "INSERT DISK NUMBER ";NO$;" IN DRIVE 1 AND HIT RETURN":INPUT " > ";CX$
770 PLOT 12
780 PLOT 27,4:PRINT "DIR 1:":PLOT 27,11
790 PRINT :INPUT " OK ? > ";A$:IF A$= "N"GOTO 760
800 PLOT 28,11
810 PRINT :PRINT "ATTEMPTING TO FILE!"
820 GOSUB 1520
830 GOTO 180
840 REM
850 REM  	*** END PROGRAM ***
860 REM
870 FILE "C",1
880 PLOT 1
890 REM   *** SELECTIVE PRINTING ***
900 REM
910 MZ$= "X":GOTO 340
920 PRINT :INPUT "ENTER DISK NUMBER (EG. 001A)  ";NO$
930 INPUT "ENTER DISK NAME (EG. SAMPLER) ";NA$
940 INPUT "HIT P TO PRINT > ";A$:IF A$< > "P"GOTO 920
950 PLOT 27,18,3,27,13,30:REM  PRINT AT 300 BAUD
960 MX$= "X":GOTO 1090
970 REM  * RETURN NODE *
980 POKE 33265,0:PRINT :INPUT "MORE PRINTING ? > ";A$
990 IF A$= "Y"GOTO 920
1000 GOTO 180
1010 REM
1020 REM  	*** PRINT ENTIRE INDEX ***
1030 REM
1040 FF= 0
1050 PLOT 27,18,3,27,13,30:REM  PRINT AT 300 BAUD
1060 FOR PR= 2TO LR
1070 FF= FF+ 1
1080 GET 1,PR;NO$[5],NA$[11]
1090 PRINT "DISK NUMBER  ";NO$" DISK NAME  ";NA$
1100 PRINT :PRINT
1110 FILE "R",2,NO$,1
1120 PRINT "FILE SPEC.";TAB( 25)"SIZE"
1130 PRINT TAB( 20)"HEX";TAB( 31)"DEC.(K)":PRINT
1140 FOR I= 2TO 32
1150 GET 2,I;PN$[12],PS$[4]
1160 GOSUB 1960
1170 IF PN$= "<FREE SPACE>"THEN PRINT PN$;TAB( 20)PS$;TAB( 30)D9$:GOTO 1200
1180 PRINT LEFT$ (PN$,6)"."RIGHT$ (PN$,6);TAB( 20)PS$;TAB( 30)D9$
1190 NEXT I
1200 FILE "C",2
1210 FOR LF= 1TO 6:PRINT :NEXT LF
1220 IF MX$= "X"GOTO 970
1230 IF FF= 3THEN PRINT CHR$ (12)
1240 IF FF= 3THEN FF= 0
1250 NEXT PR
1260 PRINT "THERE ARE "LR- 1" DIRECTORIES ON INDEX"
1270 FOR LF= 1TO 10:PRINT :NEXT LF
1280 FILE "C",1
1290 POKE 33265,0
1300 GOTO 180
1310 REM
1320 REM  	*** CHANGE FILE ***
1330 REM
1340 PRINT "THERE IS ALREADY A DISK NUMBER ";O$
1350 PRINT "IT'S NAME IS ";A$
1360 INPUT "DO YOU WISH TO UPDATE THE INDEX FOR THIS DISK ? ";ZZ$
1370 IF LEFT$ (ZZ$,1)< > "Y"THEN FILE "C",1:GOTO 180
1380 PUT 1,I;NO$[5],NA$[11]:FILE "C",1
1390 PLOT 27,4:PRINT "DEL "LEFT$ (O$,4)".RND;01":PLOT 27,27:GOTO 760
1400 REM
1410 REM  	*** CREATE FILE ***
1420 REM
1430 FILE "E",FI,EN,LN
1440 PRINT
1450 IF FI< > 1THEN PRINT "FILE ERROR #"EN" IN LINE #";LN:FOR I= 0TO 3000:NEXT :GOTO 180
1460 IF EN< > 14THEN PRINT "FILE ERROR #"EN" IN LINE #";LN:FOR I= 0TO 3000:NEXT :GOTO 180
1470 PRINT "CAN'T FIND FILE!"
1480 INPUT "WILL I CREATE A NEW ONE ? ";ZZ$
1490 IF LEFT$ (ZZ$,1)= "Y"THEN FILE "N","INDEX",100,16,8:FILE "R",1,"INDEX",13:PUT 1,1;1:FILE "C",1:RUN
1500 END
1510 REM
1520 REM 	*** FILE DIRECTORY INFORMATION ***
1530 REM
1540 FILE "N",NO$,32,16,32
1550 FILE "R",2,NO$,1
1560 DN$= "":PN$= "":PS$= ""
1570 FOR X= 24832+ 30TO 24832+ 62STEP 2
1580 DN$= DN$+ CHR$ (PEEK (X))
1590 NEXT X
1600 PUT 2;DN$[16]
1610 FOR X= 25344TO 28544STEP 128
1620 PN$= "":PS$= ""
1630 FOR Y= X+ 8TO X+ 34STEP 2
1640 IF CHR$ (PEEK (Y))= "."GOTO 1660
1650 PN$= PN$+ CHR$ (PEEK (Y))
1660 NEXT Y
1670 FOR Y= X+ 46TO X+ 52STEP 2
1680 PS$= PS$+ CHR$ (PEEK (Y))
1690 NEXT Y
1700 PUT 2;PN$[12],PS$[4]
1710 NEXT X
1720 FILE "C",2
1730 RETURN
1740 REM
1750 REM  	*** GET DIRECTORY INFORMATION ***
1760 REM
1770 FILE "R",2,NO$,1
1780 GET 2;DN$[16]
1790 PLOT 12
1800 PRINT "DIRECTORY INFORMATION FOR DISK #"NO$
1810 PRINT
1820 PRINT
1830 PRINT "THE 'ON DISK' NAME IS "DN$
1840 PRINT
1850 PRINT
1860 PRINT "FILE SPEC.";TAB( 25)"SIZE"
1870 PRINT TAB( 20)"HEX.";TAB( 31)"DEC.(K)":PRINT
1880 FOR I= 1TO 32
1890 GET 2;PN$[12],PS$[4]
1900 GOSUB 1960
1910 IF PN$= "<FREE SPACE>"THEN PRINT PN$;TAB( 20)PS$;TAB( 30)D9$:GOTO 1940
1920 PRINT LEFT$ (PN$,6)"."RIGHT$ (PN$,6);TAB( 20)PS$;TAB( 30)D9$
1930 NEXT I
1940 FILE "C",2
1950 RETURN
1960 REM
1970 REM 	*** CONVERT HEX TO DEC ***
1980 REM
1990 AD$= PS$
2000 FOR X= 1TO 4:H1$= MID$ (AD$,X,1)
2010 IF H1$= "0"THEN Z(X)= 0:GOTO 2030
2020 GOSUB 2130
2030 NEXT X
2040 D= 4096* Z(1)+ 256* Z(2)+ 16* Z(3)+ Z(4)
2050 D= INT (((D* 128/ 1000)+ .05)* 100)/ 100
2060 D9$= STR$ (D)
2070 IF LEN (D9$)= 2THEN D9$= D9$+ ".00":GOTO 2100
2080 IF MID$ (D9$,LEN (D9$)- 1,1)= "."THEN D9$= D9$+ "0"
2090 IF MID$ (D9$,LEN (D9$)- 2,1)< > "."THEN D9$= D9$+ ".00"
2100 IF LEN (D9$)< 6THEN D9$= " "+ D9$:GOTO 2100
2110 REM  D9$ IS NOW A DECIMAL NUMBER
2120 RETURN
2130 IF VAL (H1$)> 0AND VAL (H1$)< 10THEN Z(X)= VAL (H1$):RETURN
2140 Z(X)= ASC (H1$)- 55:RETURN