start tok64 d64-HL81wU 100 REM o is total number of program names currently in array (1-o) 104 REM if printer does work properly with open4,4 change line 9500 108 tn=1000:REM total number of program names permitted in memory 112 POKE53280,12:POKE53281,12:PRINT"{ct h}{ct n}{clear}{dark gray}"; 116 IFdn<>0THEN140 120 INPUT"{clear}{down*4}{space*5}Device Number ";dn 124 PRINT"{home}{down*10}"TAB(16)"loading{down}" 128 PRINTTAB(11)"Directory Master's" 132 PRINTTAB(5)"machine language sort routine" 136 LOAD"d. m. ml sort",dn,1 140 DIMp$(tn),t$(48) 144 l$="{pi*10}" 148 POKE53280,12:POKE53281,12:CLOSE2:CLOSE4:CLOSE15 152 PRINT"{ct h}{ct n}{clear}{dark gray}{down}Directory Master" 156 PRINT"{home}{down*5}{reverse on}A{reverse off}dd a program{down}" 160 PRINT"{reverse on}L{reverse off}oad directory file{down}" 164 PRINT"{reverse on}S{reverse off}ave directory file{down}" 168 PRINT"{reverse on}D{reverse off}irectory{down}" 172 PRINT"{reverse on}R{reverse off}emove a disk{down}" 176 PRINT"{reverse on}P{reverse off}rint directory file{down}" 180 PRINT"{reverse on}f2{reverse off} to sort alphabetically" 184 POKE198,0 188 GETa$ 192 IFa$="a"THEN480 196 IFa$="l"THEN508 200 IFa$="s"ANDo>0THEN556 204 IFa$="d"THEN224 208 IFa$="r"ANDo>0THEN612 212 IFa$="p"ANDo>0THEN640 216 IFa$="{f2}"ANDo>0THEN348 220 GOTO188 224 REM read a disk's directory 228 PRINT"{clear}"; 232 OPEN15,dn,15,"i0":GOSUB592:IFen>0THEN148 236 OPEN2,dn,2,"#":GOSUB592:IFen>0THEN148 240 PRINT#15,"u1:"2;0;18;0:GOSUB592:IFen>0THEN148 244 PRINT#15,"b-p:"2;162 248 GET#2,a$:GET#2,b$:id$=a$+b$ 252 sr=1:n=0 256 PRINT#15,"u1:"2;0;18;sr 260 PRINT#15,"b-p:"2;0 264 GET#2,a$:tk=ASC(a$+CHR$(0)) 268 GET#2,a$:sr=ASC(a$+CHR$(0)) 272 FORfe=0TO7:PRINT#15,"b-p:"2;fe*32+2 276 GET#2,a$:IFa$<>CHR$(130)THEN332:REM not a pgm file 280 GET#2,a$:GET#2,a$ 284 n$="" 288 FORx=1TO16 292 GET#2,a$:fm=ASC(a$+CHR$(0)) 296 IFfm=160THENx=16:GOTO308 300 REM iffm>192andfm<219thenfm=fm-128:rem converts filenames to all lowercase 304 n$=n$+CHR$(fm) 308 NEXTx 312 n=n+1:IFn=25THENPRINT"{home}"; 316 IFn>24THENPRINTTAB(20); 320 PRINT"{space*3}"n$ 324 t$(n)=n$ 328 IFn=48THENGOSUB384 332 NEXTfe:IFtk=18THEN256 336 CLOSE2:CLOSE15 340 IFn>0THENGOSUB384 344 GOTO148 348 REM sort routine 352 IFo=0THEN148 356 PRINT"{home}{down*17}{reverse on}f2 to sort alphabetically{reverse off}" 360 SYS49152,o,p$(1) 364 e=0:FORx=1TOo-1:IFp$(x)=p$(x+1)THENp$(x)=l$:e=e+1 368 NEXTx 372 IFe>0THENSYS49152,o,p$(1) 376 o=o-e 380 GOTO156 384 REM y/n subroutine 388 PRINT"{home}{down*24}Press {reverse on}y{reverse off} or {reverse on}n{reverse off} to choose program titles"; 392 p=0:n1=1:c=89:af=0 396 POKE1024+p,63:POKE55296+p,11:POKE198,0 400 IFaf=0THENGETa$ 404 IFa$=CHR$(13)THENa$=CHR$(c):af=1 408 IFa$="y"THENc=89:POKE1024+p,25:POKE55296+p,1:GOTO436 412 IFa$="n"THENc=78:POKE1024+p,14:POKE55296+p,11:GOTO420 416 GOTO400 420 p=p+40 424 IFp=960THENp=20 428 n1=n1+1:IFn1>nTHENPRINT"{clear}";:n=0:RETURN 432 GOTO396 436 REM add the title to the array if there's room 440 o=o+1:IFo=tnTHENGOTO548 500 o=o+1:p$(o)="{space*3}"+p$ 504 GOTO148 508 REM load the directory file 512 PRINT"{home}{down*7}{reverse on}Load directory file{reverse off}" 516 OPEN15,dn,15,"i0":GOSUB592:IFen>0THEN148 520 OPEN2,dn,2,"0:directory file,s,r":INPUT#15,en,em$,et,es 524 IFen=62THENCLOSE2:GOTO572 528 IFen>0THENGOSUB600:GOTO148 532 o=1 536 INPUT#2,p$(o):p$(o)="{space*3}"+p$(o) 540 IFst=64THENCLOSE2:CLOSE15:GOTO156 544 o=o+1:IFo0THEN148 568 OPEN2,dn,2,"0:directory master,p,r":INPUT#15,en:CLOSE2:IFen<>62THEN576 572 CLOSE15:PRINT"{home}{down*21}{reverse on}Put master disk in drive{reverse off}":GOTO736 576 PRINT#15,"s0:directory file":GOSUB592:IFen>1THEN148 580 OPEN2,dn,2,"0:directory file,s,w":GOSUB592:IFen>0THEN148 584 FORx=1TOo:PRINT#2,p$(x):INPUT#15,en:IFen>0THENx=o 588 NEXTx:CLOSE2:CLOSE15:GOTO156 592 REM disk error 596 INPUT#15,en,em$,et,es:IFen<2THENRETURN 600 CLOSE2:CLOSE15:PRINT"{home}{down*20}Disk Error:"en:PRINTem$ 604 PRINT"track"et" sector"es 608 POKE2023,160:POKE56295,11:WAIT197,64,255:RETURN 612 REM delete a record 616 PRINT"{home}{down*13}{reverse on}Remove a disk{reverse off}{down*7}" 620 GOSUB452 624 IFi$=""THEN148 628 e=0:FORx=1TOo:IFLEFT$(p$(x),2)=i$THENp$(x)=l$:e=e+1 632 NEXTx:IFe>0THENSYS49152,o,p$(1) 636 o=o-e:GOTO148 640 REM print out directory file 644 PRINT"{home}{down*15}{reverse on}Print directory file{reverse off}{down*5}" 648 PRINT"{reverse on}S{reverse off}ingle disk{space*2}or{space*2}{reverse on}E{reverse off}ntire file?":POKE198,0 652 GETb$:IFb$=CHR$(13)THEN148 656 IFb$="e"THEN672 660 IFb$<>"s"THEN652 664 GOSUB452 668 IFi$=""THEN148 672 PRINT:PRINT"{reverse on}P{reverse off}rinter{space*2}or{space*2}{reverse on}S{reverse off}creen?":POKE198,0 676 GETa$:IFa$="s"THENpr=3:GOTO692 680 IFa$="p"THENpr=4:GOTO692 684 IFa$=CHR$(13)THEN148 688 GOTO676 692 IFpr=3THENPRINT"{clear}{down*26}" 696 OPEN4,pr,7:PRINT#4,"{space*6}directory master":PRINT#4," ":PRINT#4," " 700 IFb$="s"THENPRINT#4,"{space*8}disk id: "i$:PRINT#4," " 704 FORx=1TOo 708 IFb$<>"s"THEN720 712 IFLEFT$(p$(x),2)=i$THEN720 716 GOTO728 720 PRINT#4,LEFT$(p$(x)+"{space*15}",20); 724 IFpr=3THENGETa$:IFa$=""THEN724 728 IFa$=CHR$(13)THEN148 732 NEXTx:PRINT#4:CLOSE4:POKE2023,160 736 GETa$:IFa$<>CHR$(13)THEN736 740 GOTO148 744 REM * * * * * * * * * * * * * * * 748 REM * directions * 752 REM * * 756 REM * press return to abort any * 760 REM * command, even in the * 764 REM * middle of printing! * 768 REM * if picking program titles * 772 REM * with (y/n) press return * 776 REM * to finish the list, all * 780 REM * with the last response. * 784 REM * printing to screen can be * 788 REM * slowed by pressing ctrl * 792 REM * or frozen with spacebar * 796 REM * the directory file must * 800 REM * be on the same disk as * 804 REM * d. m. ml sort and * 808 REM * directory master * 812 REM * if the computer freezes * 816 REM * up at any time, press * 820 REM * run/stop and restore, * 824 REM * then goto 100 to resume * 828 REM * with the memory intact. * 832 REM * * * * * * * * * * * * * * * stop tok64 (bastext 1.0)