Compucolor.org – Virtual Media

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

90 PLOT 15,12
100 REM CHANGE DIRECTORY INFORMATION -V2.80- J.J.
110 B= INT (FRE (9)/ 128)- 4:IF B> 9GOTO 130
120 PLOT 11:PRINT "NOT ENOUGH SPACE FREE.":END
130 GOSUB 990:E= E- B* 128- 2:POKE E+ 1,B:GOSUB 1000:CLEAR 150
140 GOSUB 990:X= E+ 1:B= PEEK (X):GOSUB 1070:E$= H$
150 DEF FN B(Z)= PEEK (Z)+ PEEK (Z+ 1)* 256
160 DEF FN L(Z)= Z- INT (Z/ 256)* 256
170 DEF FN H(Z)= INT (Z/ 256)
180 DEF FN R(Z)= INT (Z* 100+ .5)/ 100
190 PLOT 19,10:PRINT "MOUNT DISK WITH DIRECTORY TO BE CHANGED";
200 GOSUB 1050:PLOT 14,12,6,5
210 PRINT TAB( 9)"D I R E C T O R Y      I N F O R M A T I O N"
220 PLOT 3,64,1:L= 2:NF= 0:F= 0
230 A$= "REA 0 "+ E$+ " ":A1$= "80":GOSUB 1040
240 D= PEEK (E+ 2)+ 1:X= D* 128:GOSUB 1070:DB$= H$:ND= D
250 A1$= DB$:GOSUB 1040:FOR I= 0TO D- 1:FOR J= 2TO 107STEP 21
260 A= PEEK (E+ 1+ I* 128+ J):IF A= 3THEN NF= NF+ 1
270 IF A= 1GOTO 290
280 NEXT J,I:PRINT "NO DIRECTORY!":GOTO 1200
290 A= E+ I* 128+ J+ 12:S= FN B(A):SB= S
300 X= SB:GOSUB 1070:SB$= H$:SZ= 400- SB:X= SZ:GOSUB 1070:SZ$= H$
310 TF= ND* 6- 2:NU= TF- NF
320 B1= FN R((NF+ 1)/ 6):B2= FN R((NU+ 1)/ 6)
330 N$= "":FOR I= E+ 4TO E+ 13:N$= N$+ CHR$ (PEEK (I)):NEXT I
340 PLOT 3,0,5,6,7:PRINT "1. DIRECTORY NAME: "N$"         "
350 PLOT 6,7:PRINT "2. NUMBER OF DIRECTORY BLOCKS: ";
360 X= ND:GOSUB 1070:PRINT RIGHT$ (H$,2)"(HEX) "ND"(DEC) "
370 PRINT TAB( 3)"MAX. NUMBER OF FILES (2.*6-2):"TF"(DEC)  "
380 PLOT 11:PRINT TAB( 12)"NUMBER OF FILES USED:"NF"(DEC)";
390 PRINT ""B1"(DEC) BLOCK(S)"
400 PLOT 11:PRINT TAB( 8)"NUMBER OF FILES NOT USED:"NU"(DEC)";
410 PRINT ""B2"(DEC) BLOCK(S)"
420 PRINT TAB( 12)"<FREE SPACE> SBLK: ";
430 PRINT SB$"(HEX)"SB"(DEC)   ":PRINT TAB( 25)"SIZE: ";
440 PRINT SZ$"(HEX)"SZ"(DEC)   "
450 PLOT 3,0,21,11
460 PRINT "CHANGE 1. OR 2. (ENTER 1, 2, A=ABORT E=EXECUTE ";
470 INPUT "CHANGE)? ";Z$:PLOT 11,28,11
480 IF Z$< > "1"GOTO 580
490 NN$= "":INPUT "ENTER THE DESIRED NEW NAME: ";NN$
510 IF NN$= "0"THEN PRINT "NAME WAS NOT CHANGED.":GOTO 450
520 IF LEN (NN$)< 11GOTO 550
530 PRINT "NAME MUST BE <=10 CHAR. INCLUDING CONTROL CHAR."
540 PLOT 28,28:GOTO 490
550 NN$= NN$+ "          ":J= 0:FOR I= E+ 4TO E+ 13:J= J+ 1
560 POKE I,ASC (MID$ (NN$,J,1)):NEXT I:IF F< > 2THEN F= 1
570 PLOT 11:GOTO 330
580 IF Z$< > "2"GOTO 680
590 PRINT "ENTER THE DESIRED NUMBER OF DIRECTORY";
600 INPUT " BLOCKS (DEC): ";DN
610 DN= INT (DN)
620 IF DN> = B1+ .17AND DN< = 32AND DN< = ND+ SZGOTO 660
630 PRINT "NUMBER OF BLOCKS ALLOWED >="INT (B1+ 1)" AND <=";
640 IF ND+ SZ> = 32THEN PRINT " 32":PLOT 28,28,11:GOTO 590
650 PRINT ND+ SZ:PLOT 28,28,11:GOTO 590
660 IF DN= NDTHEN PLOT 11:GOTO 450
670 F= 2:ND= DN:SB= S- D+ ND:PLOT 11:GOTO 300
680 IF Z$< > "E"GOTO 940
690 IF F= 0GOTO 940
700 PLOT 3,24,21,6,65:PRINT "* WORKING *":PLOT 6,1
710 A$= "WRI 0 "+ E$+ " ":PLOT 3,64,17:L= 18
720 IF F= 1THEN A1$= "80":GOSUB 1040:PLOT 3,0,21:GOTO 950
730 IF ND= DTHEN PLOT 3,0,21:GOTO 950
740 X= INT (B1+ 1):FOR I= 0TO X- 1:POKE E+ 2+ I* 128,ND- 1
750 NEXT I:X= X* 128:GOSUB 1070:A1$= H$
760 B1= ND:FOR I= 0TO D- 1:FOR J= 2TO 107STEP 21
770 X= E+ 1+ I* 128+ J:A= PEEK (X):IF I= 0AND J= 2GOTO 820
780 X= X+ 11:POKE X,FN L(ND):POKE X+ 1,FN H(ND)
790 X= X+ 2:IF A< > 1GOTO 810
800 POKE X,FN L(SZ):POKE X+ 1,FN H(SZ):GOTO 830
810 ND= ND+ FN B(X)
820 NEXT J,I
830 GOSUB 1040
840 ND= B1:IF ND> DGOTO 890
850 B1= D:B2= ND
860 IF B1> = STHEN PLOT 3,0,21:GOTO 950
870 X= B* 128:IF S- B1< BTHEN X= (S- B1)* 128
880 GOSUB 1010:B1= B1+ B:B2= B2+ B:GOTO 860
890 BT= B:B1= S- B:IF B1< DTHEN B1= D:B= S- D
900 B2= SB- B
910 X= B* 128:GOSUB 1010:IF B< BTTHEN B= BT:PLOT 3,0,21:GOTO 950
920 B1= B1- B:IF B1< DTHEN B= B- D+ B1:B1= D
930 B2= B2- B:GOTO 910
940 PRINT " DIRECTORY WAS NOT CHANGED."
950 INPUT " CHANGE ANOTHER DIRECTORY (Y OR N) ? ";A$
960 IF LEFT$ (A$,1)= "Y"GOTO 190
970 E= E+ B* 128+ 2:GOSUB 1000:CLEAR 50:PLOT 10,19
980 PRINT "MOUNT PROGRAM DISK ";:GOSUB 1050:PLOT 1
989 REM MOVE END OF MEMORY
990 LM= 32940:HM= LM+ 1:E= PEEK (HM)* 256+ PEEK (LM):RETURN
1000 POKE HM,INT (E/ 256):POKE LM,E- INT (E/ 256)* 256:RETURN
1009 REM SUBROUTINES
1010 GOSUB 1070:DB$= H$:X= B1:GOSUB 1070:A$= "REA "+ H$
1020 A1$= " "+ E$+ " "+ DB$:GOSUB 1040
1030 X= B2:GOSUB 1070:A$= "WRI "+ H$:GOSUB 1040:RETURN
1040 PLOT 15,27,4:PRINT A$A1$:PLOT 27,27:GOSUB 1180:RETURN
1050 PLOT 19:PRINT " (HIT ";:PLOT 6,71:PRINT "RETURN ";:PLOT 6,3
1060 PRINT "WHEN READY)"SPC( 6):PLOT 3,64,5:INPUT "";Z$:RETURN
1069 REM X=DEC TO HEX=H$
1070 H$= "":XX= X:FOR II= 3TO 0STEP - 1
1080 IF II= 0THEN X1= XX:GOTO 1100
1090 X1= INT (XX/ 16^ II):XX= XX- X1* 16^ II
1100 IF X1< 10THEN X1= X1+ 48:GOTO 1120
1110 X1= X1+ 55
1120 H$= H$+ CHR$ (X1):NEXT II:RETURN
1129 REM H$=HEX TO DEC, XL=LOW BYTE, XH=HIGH BYTE
1130 H1$= "0000"+ H$:XL= 0:XH= 0:FOR II= 0TO 1
1140 X1= II+ 1:GOSUB 1160:XL= XL+ X1* 16^ II
1150 X1= II+ 3:GOSUB 1160:XH= XH+ X1* 16^ II:NEXT II:RETURN
1160 X1= ASC (RIGHT$ (H1$,X1)):IF X1> 64THEN X1= X1- 55:RETURN
1170 X1= X1- 48:RETURN
1179 REM ERROR CHECK
1180 I= PEEK (L* 128+ 24576):IF I= 69OR I= 70GOTO 1200
1190 PLOT 14:RETURN
1200 PLOT 6,65,3,20,L:PRINT "ERROR":PLOT 6,2,14,3,0,21:GOTO 950