10
100 HIMEM=&8000:A%=FNfx(135,0)DIV256:MODE&80+A%+(A%=7):PROCsz:IFwd%<40:MODE&86:PROCsz
110 DIMctrl%30,data%80:X%=ctrl%:Y%=X%DIV256:A$=FNOS_GetEnv:quit$=FNcl(" -q",1):in%=0:ONERRORIFFNerr:PROCend
120 PRINTTAB(0,0)FNc(1)SPC(wd%DIV2-19)"Textual Filer 0.43 (C)1998 J.G.Harston"SPC(wd%-POS)FNc(0);:md$=FNcl("-m",1):debug%=FNcl("-d",0)
130 IFFNcl("-?",0):PRINT"Syntax: "run$" (<dir>) (-quit <fname>)":PROCend
140 PROCInit:IFmd$="":IFFNfx(130,0):IFFNfx(133,&80)>LOMEM+&1000:md$="0"
150 IFmd$<>"":A$=md$:md$="":MODEVALA$OR&80:PROCsz
160 exit$="":IFrun$<>"":exit$=" -quit "+run$+" -mode "+STR$(FNfx(135,0)DIV256):IFquit$<>"":exit$=exit$+" -quit "+quit$
170 PROCChkDate:ONERRORIFFNerr:PROCend
180 REPEAT:X%=ctrl%:Y%=X%DIV256:PROCRdDir:PROCDisp:UNTILFNmenu
190 PRINT:PROCend:END
210 DEFPROCInit:y%=3:err%=FALSE:X%=ctrl%:Y%=X%DIV256:max%=max%:IFmax%:ENDPROC
220 max%=35:DIMn$(max%),l%(max%),e%(max%),n%(max%),a%(max%),t%(max%):w$=""
230 DIMt$(19):t$(0)="Data":t$(1)="File":t$(2)="Directory":t$(3)="Application"
240 t$(4)="Text":t$(5)="Exec":t$(6)="MCode":t$(7)="Utility":t$(8)="Basic"
250 t$(9)="ROM":t$(10)="Teletext":t$(11)="Archive":t$(12)="Font":ptr%=0
260 t$(13)="Screen":dw%=1:fs%=FNfs:PROCDrv:Path$=FNp:Sc$="":Ar$="":Tr$=""
270 FORz%=0TO2:a$=MID$("$.%.",5-2*z%,2):d$=a$:IFd$="":d$=Path$+"."
280 IFSc$="":IFFNfile(d$+"Scroll",5)=1:Sc$=d$+"Scroll"
290 IFAr$="":IFFNfile(d$+"Archive",5)=1:Ar$=d$+"Archive"
300 IFTr$="":IFFNfile(d$+LEFT$("TreeCopy",10+3*(FNfs=4)),5)=1:Tr$=d$+LEFT$("TreeCopy",10+3*(FNfs=4))
310 A%=(Sc$<>""ANDAr$<>""ANDTr$<>""):IFA%:z%=3
320 IFNOTA%ANDz%=0:IFFNfile("%",5)<>2:z%=1
330 NEXT:ENDPROC
350 DEFPROCon:VDU23,1;0;0;0;0:*FX4,2
360 *FX225,128
370 ENDPROC
380 DEFPROCoff:VDU23,1,1;0;0;0;:*FX4
390 *FX225,1
400 ENDPROC
410 DEFPROCend:PROCoff:PRINTFNc(0);:IFquit$<>"":A$=quit$:quit$="":PROCos(A$):END
420 END
430 DEFFNS=$(PAGE+8)
440 DEFFNerr:PRINTFNc(1);TAB(0,y%);SPC(80);TAB(0,y%-1);:REPORT:PRINTFNc(0);
450 PROCCloseIn:A%=INKEY(50):=debug%ANDINKEY-1
470 DEFPROCCloseIn:IFin%:A%=in%:in%=0:CLOSE#A%
480 ENDPROC
490 DEFPROCoswD(A%,D%,E%):LOCALX%,Y%:X%=data%:Y%=X%DIV256:!X%=D%:X%!4=E%:CALL&FFF1:ENDPROC
500 DEFFNbyte(A%,X%,Y%)=((USR&FFF4)AND&FF00)DIV256
510 DEFFNfx(A%,X%):LOCALY%:Y%=X%DIV256:=((USR&FFF4)AND&FFFF00)DIV256
520 DEFFNfile(A$,A%):$data%=A$:?X%=data%:X%?1=data%DIV256:=(USR&FFDD)AND&FF
530 DEFFNgbpb(A%):X%!1=data%:CALL&FFD1:A%=data%+((A%<>5)AND(1+?data%)):A%?(1+?A%)=13:=$(A%+1)
540 DEFFNfs:LOCALA%,Y%,E%:=(USR&FFDA)AND&FF
550 DEFFNtime:A%=14:?X%=0:CALL&FFF1:IF?X%:X%?24=13:=$X% ELSE =""
560 DEFFNDofW(d$):=0
570 DEFFNh(A%,N%)=RIGHT$("0000000"+STR$~A%,N%)
580 DEFFNd(A%,N%)=RIGHT$("0000000"+STR$A%,N%)
590 DEFFNu(A$):LOCALA%,B$:FORA%=1TOLENA$:B$=B$+CHR$(ASCMID$(A$,A%,1)+32*(MID$(A$,A%,1)>"`")):NEXT:=LEFT$(B$,LENA$)
600 DEFFNp:IFFNfs=4:OSCLI"DIR$":="$"
610 LOCALn$,p$:A%=6:REPEAT
620 X%!1=data%:CALL&FFD1:?(data%+2+?data%+?(data%+?data%+1))=13:n$=$(data%+2+?data%):*DIR ^
630 n$=LEFT$(n$,INSTR(n$+" "," ")-1):p$=n$+"."+p$:UNTILn$="$"
640 p$=LEFT$(p$,LENp$-1):OSCLI"DIR "+p$:=p$
650 DEFFNOS_GetEnv:LOCALA$:A%=0:X%=1:os%=((USR&FFF4)AND&FF00)DIV256
660 IFos%=6ANDPAGE>&8000:SYS"OS_GetEnv"TOA$:A$=MID$(A$,1+INSTR(A$," "))
670 IFos%=32:A$=$&100
680 IFLENA$=0:IF?(TOP-3):A$=$&600 ELSE IFLENA$=0:A$=$&3800
690 A%=0:REPEATA%=A%+1:UNTILA%=LENA$ORASCMID$(A$,A%)<32ORASCMID$(A$,A%)>126:IFA%<>LENA$:A$=""
700 A%=INSTR(A$+" "," "):run$=LEFT$(A$,A%-1):IFrun$<>"":=MID$(A$,A%+1)
710 X%=ctrl%:Y%=X%DIV256:A%=9:?X%=0:X%!1=data%:!data%=0:CALL&FFD1:IF!data%AND?data%+data%?2<>8:data%?(1+data%)=13:=$(data%+1)
720 =""
730 DEFFNcl(l$,n%):IFASCl$=32 AND A$<>"":A$=" "+A$
740 I%=INSTR(A$,l$):l$="":IFI%>0ANDn%>0:l$=MID$(A$,INSTR(A$+" "," ",I%+1)+1):IFMID$(A$,I%,1)<>" ":l$=LEFT$(l$,INSTR(l$+" "," ")-1)
750 IFI%:IFMID$(A$,I%,1)=" ":A$=MID$(A$,2+(ASCA$<>32),I%-2-(I%=1)) ELSE IFI%:A$=LEFT$(A$,I%-1)+MID$(A$,INSTR(A$+" "," ",INSTR(A$+" "," ",I%)+LENl$)+1)
760 A$=FNs(A$):IFn%:=FNs(l$) ELSE =I%<>0
770 DEFPROCos(A$):IFA$=""ORASCA$=42:OSCLIA$:ENDPROC ELSE CHAINA$:ENDPROC
790 DEFPROCKey(A$):OSCLI"Key0"+A$:OSCLI"FX138,0,192":ENDPROC
800 DEFFNs(A$):IFLEFT$(A$,1)=" ":REPEATA$=MID$(A$,2):UNTILLEFT$(A$,1)<>" "
810 IFRIGHT$(A$,1)=" ":REPEATA$=LEFT$(A$,LENA$-1):UNTILRIGHT$(A$,1)<>" "
820 =A$
830 DEFFNget(P%,V%):LOCALp%,v%,A$:p%=POS:v%=VPOS:REPEATPRINTTAB(P%,V%);MID$(FNtime,17);TAB(p%,v%);:A$=INKEY$(100):UNTILA$<>"":=A$
840 DEFPROCsz:wd%=FNbyte(160,10,0)-FNbyte(160,8,0)+1:ht%=FNbyte(160,9,0)-FNbyte(160,11,0)+1:ENDPROC
850 DEFFNc(A%):COLOUR7AND(A%=0):COLOUR128+(7AND(A%<>0)):=""
870 DEFPROCChkDate:A$=FNtime:IFA$<>"" ANDMID$(A$,5,2)<>"00" AND A$<>"Fri,31 Dec 1999.23:59:59":ENDPROC
880 INPUT" Enter the date (DD/MM/YY): "d$:IFINSTR(d$," ")=0 AND d$<>"":d$=d$+" 0"+STR$FNday(d$)
890 IFFNfs=16:OSCLI"HSETDATE "+d$
900 INPUTLINE" Enter the time (HH:MM): "t$:IFt$<>"":TIME=(60*INTVALt$+VALRIGHT$(t$,2))*60*100
910 ENDPROC
920 DEFFNday(d$):d%=VALd$:m%=VALMID$(d$,INSTR(d$,"/")+1):y%=1900+VALRIGHT$(d$,2):IFy%<1980:y%=y%+100
930 y%=y%MOD400:=(y%*365.25+m%*30+d%+VALMID$("120112234455",m%,1)+((y%MOD4)=0)-((y%-1)DIV100)-(m%>2 AND((y%MOD4)=0 AND(y%MOD100)<>0 ORy%=0))+3)MOD7+1
950 DEFPROCDrv:Dir$=FNs(FNgbpb(6)):data%?(1+?data%)=13:Drive$=FNs($(data%+1)):Disk$=FNs(FNgbpb(5)):A%=FNfs:I%=1+INSTR("00405060816",STR$A%)DIV2:FS$=MID$("DISKNETHADFS"+STR$A%,VALMID$("110105110908",I%*2-1,2),VALMID$("543545",I%,1)):ENDPROC
960 DEFPROCRdDir:IFerr%:ENDPROC
970 PROCHdr:err%=TRUE:IFFNfs<>fs%:PROCDrv:Path$=FNp
980 a%=8:a%=10:in%=OPENIN("@"):IFin%=0:a%=8
990 p%=0:n%=0:sel%=0:fs%=FNfs:REPEAT
1000 ?X%=in%:X%!1=data%:X%!5=1:X%!9=p%:!data%=0:A%=a%:CALL&FFD1
1010 r%=X%!5:IFA%=10:r%=1-r%:IFX%!9=0ANDr%=0:a%=8:r%=2
1030 p%=X%!9:IFr%=0:PROCRdName:n%=n%+1
1040 UNTILr%=1ORn%>max%:err%=FALSE:PROCCloseIn
1050 ENDPROC
1070 DEFPROCRdName:IFA%=8:data%?(1+?data%)=13:f$=$(data%+1)ELSE data%?40=13:f$=$(data%+20):f$=LEFT$(f$,INSTR(f$,CHR$0)-1)
1080 f$=FNs(f$):IFASCf$=46:n%=n%-1:ENDPROC
1090 n$(n%)=f$:IFA%<>8:t%(n%)=data%!16:A%=data% ELSE X%!14=0:t%(n%)=FNfile(f$,5):A%=X%+2:IFfs%=5:$(data%+8)=f$:PROCoswD(&14,&12002000,&40000000):X%!15=data%!10
1100 l%(n%)=!A%:e%(n%)=A%!4:n%(n%)=A%!8:a%(n%)=A%!12AND(-129OR(fs%<>8))
1110 IFt%(n%)=2:IFLEFT$(f$,1)="!":t%(n%)=3:ENDPROC ELSEIFt%(n%)=2:ENDPROC
1120 IF(!A%ORA%!4)=0OR(A%!1AND&FFFFFF)=&FFFFFD:t%(n%)=0:ENDPROC
1130 IF(!A%AND&FFFF)=&8000 OR(A%!1AND&FFFFFF)=&FFFBBC:t%(n%)=9:ENDPROC
1140 IF(A%!1AND&FFFFFF)=&FFFF7C:t%(n%)=10:ENDPROC
1150 IF(A%!1AND&FFFFFF)=&FFFFF7:t%(n%)=12:ENDPROC
1160 IFA%!4=TRUE:t%(n%)=5:ENDPROC
1170 IF(A%!1AND&FFFFFF)=&FFFFFF:t%(n%)=4:ENDPROC
1180 IF(A%!1AND&FFF)=&FFBOR((A%!2AND&FFFF)=(A%!6AND&FFFF)AND((?A%=0AND(A%?5AND&C0)=&80)OR(!A%<A%!4ANDA%?5<&80 AND!A%+A%!8-A%!4<&100 ANDA%!8>&80 ANDA%?1>&1F))):t%(n%)=8:ENDPROC
1190 IFA%?1>&0F ANDA%?1<&7C:t%(n%)=6:ENDPROC
1200 IF(A%!2AND&FFFF)=(A%!6AND&FFFF)AND((A%?1AND&F8)=8ORA%?1=&DD):t%(n%)=7:ENDPROC
1220 ENDPROC
1240 DEFFNa(A%,T%):A%=A%AND&FF:LOCALA$:IFfs%<>16:A%=A%AND&7F
1250 IFA%AND1:A%=A%AND&FB
1260 IFA%AND16:A%=A%AND&BF
1270 IFA%AND&80:A$="P"
1280 A%=256*(A%AND15)ORA%:IFT%=2ORT%=3:A$=A$+"D":A%=A%AND&880
1290 FORT%=1TO9:IF(A%AND&800):A$=A$+MID$("LEWRewr",T%,1)
1300 IFT%=4:A$=A$+"/":A%=A%*2
1310 A%=A%*2:NEXT:=LEFT$(A$+" ",7)
1320 DEFFNdt(A%):A%=(A%AND&FFFF00)DIV256:IFA%=0:="00/00/0000"
1330 =FNd(A%AND31,2)+"/"+FNd((A%AND&F00)DIV256,2)+"/"+FNd(1981+((A%AND&F000)DIV&1000)+(A%AND&E0)DIV2,4)
1340 DEFFNat(p%):PRINTTAB((wd%DIVx%)*(p%MODx%),1-(wd%<80)+p%DIVx%);:=""
1350 DEFFNat2(p%):PRINTTAB(sz%+(wd%DIVx%)*(p%MODx%),1-(wd%<80)+p%DIVx%);:=""
1360 DEFPROCpr(z%):PRINT" "FNc(t%(z%)AND&10000);LEFT$(n$(z%)+" ",10);
1370 IF(dw%AND4):PRINT" "FNh(l%(z%),8)" "FNh(e%(z%),8)" "FNh(n%(z%),6);
1380 IF(dw%AND1):PRINT" "FNa(a%(z%),t%(z%)AND&FF);
1390 IF(dw%AND4):PRINT" "FNdt(a%(z%));
1400 IF(dw%AND2):PRINT" "LEFT$(t$(t%(z%)AND&FF)+" ",9);
1410 PRINTFNc(0);SPC((dw%AND2)+2+((dw%AND3)=1)-(dw%=2));:IFPOS>(wd%-14)OR(dw%AND4)PRINT
1420 ENDPROC
1440 DEFPROCHdr:PRINTFNc(0);:CLS:PRINTFNc(1)LEFT$(" Drive "+Drive$,-80*(Drive$<>""))SPC((78-POS-wd%/2)-LEN(LEFT$(FS$+Disk$+Path$,57+22*(wd%<80)))DIV2)RIGHT$(FS$+"::"+Disk$+"."+Path$,60+22*(wd%<80))SPC(wd%-POS)FNc(0);:ENDPROC
1450 DEFPROCDisp:IF(dw%=2 OR(dw%AND7)>3)ANDwd%<80:dw%=dw%AND3:IFdw%=2:dw%=3
1460 IFwd%=80 ANDdw%=3:dw%=5
1470 PROCHdr:IFerr%:VDU11:REPORT:PRINT:n%=0ELSEIFn%=0:PRINT"Empty" ELSE z%=0:REPEATPROCpr(z%):z%=z%+1:UNTILz%=n% OR VPOS=ht%-3:IFPOS:PRINT
1480 y%=VPOS:IFptr%>=n%:ptr%=n%-1
1490 PRINTFNc(1)" Access, Copy, Delete, Full info, Goto,"SPC((wd%<80)AND1)" cHange drive, Load, Move, New dir"LEFT$("ectory",-6*(wd%>40))","SPC(1+((wd%<80)AND5))"OS Command, Quit, Rename, setType, Up,"SPC(1-(wd%<80));
1510 PRINT"^A=All, ^C=Clear, RETURN=Run, *"SPC(wd%-POS)FNc(0);:sz%=11+8*(dw%AND1)+5*(dw%AND2)+9*(dw%AND4):x%=wd%DIV(sz%+1):IFw$<>"" ANDerr%=0:err%=TRUE:OSCLI"."+w$:err%=FALSE
1520 ENDPROC
1540 DEFFNmenu:err%=FALSE:PROCon:B$="!!":REPEAT:REPEATPRINTFNat(ptr%);:ptr%=ptr%+(VPOS>ht%-4):UNTILVPOS<ht%-3:optr%=ptr%
1550 IFn%:PRINTFNat(ptr%)">"FNat2(ptr%)"<";
1560 PRINTFNc(1);:REPEATA$=FNget(wd%-9,0):IFA$>"`" ANDA$<"{":A$=CHR$(ASCA$-32)
1570 IFA$="^":A$="U"
1580 IFn%=0 AND INSTR("ACDLMOPRST‹ŚŤŽŹ"+CHR$1+CHR$3+CHR$13,A$)<>0:A$="!"
1590 UNTILINSTR("*ACDFGHLMNOPQRSTUWZ‹ŚŤŽŹ"+CHR$1+CHR$3+CHR$13,A$):B$=A$+LEFT$(B$,1):PRINTFNc(0);:IFn%=0:ptr%=0
1600 IFINSTR("ŚŤŹŽ",A$):PRINTFNat(ptr%)" "FNat2(ptr%)" ";:ptr%=ptr%+(A$="Ś")-(A$="Ť")+x%*(A$="Ź")-x%*(A$="Ž"):ptr%=ptr%AND(ptr%>0):IFptr%>=n%:ptr%=n%-1
1610 IF(INSTR("ACDMORTS",A$)ANDsel%<1)OR(A$=CHR$13 AND((t%(ptr%)AND&10000)=0)):t%(ptr%)=t%(ptr%)OR&10000:PRINTFNat(ptr%);:PROCpr(ptr%):sel%=sel%+1:IFA$=CHR$13:A$="!":optr%=ptr%
1620 IFINSTR(CHR$1+CHR$3,A$):FORz%=0TOn%-1:t%(z%)=(t%(z%)AND&FFFF)OR((A$=CHR$1)AND&10000):NEXT:sel%=n%AND(A$=CHR$1):PROCDisp:A$="!"
1630 IFA$=CHR$13 AND B$<>CHR$13+CHR$13:A$="!"
1640 IFA$="‹" AND(t%(ptr%)AND&10000):t%(ptr%)=t%(ptr%)AND&FFFF:PRINTFNat(ptr%);:PROCpr(ptr%):sel%=sel%-1
1650 IFINSTR("LR",A$)ANDsel%>1:A$="!"
1660 IFA$="Z":dw%=VALMID$("1235.7.0",dw%+1,1):PROCDisp:A$="!"
1670 IFA$="W":PROCw:INPUT"Output window: "w$:A$="!":PROCDisp:PROCon
1680 IFA$="F":dw%=(1AND(dw%>2))+(7AND(dw%<3)):PROCDisp:A$="!"
1690 UNTILINSTR("!‹ŚŤŽŹ",A$)=0:f$=n$(ptr%):IFsel%=1:f$=n$(optr%) ELSE IFsel%>1:f$="<selection>"
1700 PROCw:IFB$=CHR$13+CHR$13 ANDsel%=1:PROCRun(""):=0
1710 IFA$=CHR$13:=0
1720 IFA$="O":INPUT"*"A$:PRINTTAB(0,y%)" "A$" "f$;" ";:INPUT""a$:VDU11AND(sel%>1):PRINTFNc(sel%>1);:PROCdo(A$):PROCChkEx:A%=((sel%<2 AND VPOS>y%+1)AND&7FFF):PRINTLEFT$("**** Press SPACE ****",A%);:A%=INKEY(A%):=0
1730 IFA$="*":REPEATINPUTLINE"*"A$:PRINTFNc(0);:OSCLIA$:UNTILA$="":fs%=0:=0
1740 I%=INSTR("ACDGHLMNQRSTU",A$):PRINTMID$("Set Access ofCopyDeleteGoto directoryChange to driveLoadMoveNew directoryQuitRenameStampSetType ofGo Up",VALMID$("*01141824385357617478848999",I%*2,2),VALMID$("*13040614150404130406051005",I%*2,2));" ";
1750 IFINSTR("ACDLMRST",A$):PRINTf$;:IFINSTR("ACLMRT",A$):PRINT" to ";
1760 a$="!":IFINSTR("QU",A$)=0:INPUT""a$:VDU11
1770 PROCon:IFA$="A":PROCdo("Access"):=0
1780 IFINSTR("CM",A$):PROCCopy(A$="M"):=0
1790 IFA$="D":PROCdo("Delete"):=0
1800 IFA$="G":PROCGoto(a$):=0
1810 IFA$="H":PROCGoto(MID$(":"+a$,1-(LEFT$(a$,1)=":"))):=0
1820 IFA$="L":PROCLoad:=0
1830 IFa$="":=0
1840 IFA$="N":OSCLI"CDir "+a$:=0
1850 IFA$="R":OSCLI"Rename "+f$+" "+a$:=0
1860 IFA$="S":PROCdo("!Stamp"):=0
1870 IFA$="T":a$=FNtype(a$):PROCdo("!SetType"):=0
1880 IFA$="U":PROCUp:=0
1890 =A$="Q"
1900 DEFPROCw:PRINTTAB(0,y%);FNc(1);SPC(wd%)FNc(0)SPC(80+(wd%MOD80))TAB(1,y%);FNc(1);:PROCoff:ENDPROC
1920 DEFPROCCall(N$,A$,B$):IFA$<>"":PROCos(A$+" "+B$+exit$) ELSE PRINTCHR$13;" '"N$"' not available"SPC(wd%-POS);CHR$13;:A%=INKEY(50)
1930 ENDPROC
1950 DEFPROCChkEx:IFFNbyte(198,0,255):END ELSE ENDPROC
1960 DEFPROCRun(a$):PRINTTAB(0,y%)FNc(1)" Select "f$" "a$FNc(0);:T%=t%(ptr%)AND&FF:PROCoff
1970 IFT%=2ORT%=3:PROCDir(f$):ENDPROC
1980 PRINT:IFT%=4:PROCCall("Scroll",Sc$,f$):ENDPROC
1990 IFT%=5:OSCLI"Exec "+f$:END
2000 IF(T%AND&FE)=6:OSCLI"Run "+f$+" "+a$:ENDPROC
2010 IFT%=8 AND(l%(ptr%)AND&FFF00)=&FFB00:PROCCall("",f$,a$):ENDPROC
2020 IFT%=8 ANDe%(ptr%)=&7B00:OSCLI"Run "+f$+" "+a$:ENDPROC
2030 IFT%=8:CHAINf$:ENDPROC
2040 IFT%=9:PROCKey("/SrLoad "+f$+" I|MCH."""+run$+"""|M"):END
2050 IFT%=10
2060 IFT%=11:PROCCall("Archive",Ar$,f$):ENDPROC
2070 IFT%=12:OSCLI"Exec "+f$:INPUT""f$:ENDPROC
2080 ENDPROC
2100 DEFPROCLoad:PRINTTAB(0,y%)FNc(1)" Load "f$" to "a$;FNc(0);:T%=t%(ptr%)AND&FF:PROCoff:a$=FNu(a$)
2110 IFa$="VIEW"ORa$="WORD":T%=4
2120 IFa$="BASIC":T%=8
2130 IF(T%AND&FE)=4 ANDa$="":PROCKey("LOAD "+f$+"|M"):*WORD
2140 IF(T%AND&FE)=4:PROCKey("READ "+f$+"|M"):*WORD
2150 IFT%=1OR(T%AND&FE)=6:OSCLI"Load "+f$+" "+a$:ENDPROC
2160 IFT%=8:PROCKey("LOAD"""+f$+"""|F|M"):VDU21:END
2170 ENDPROC
2190 DEFPROCDir(f$):OSCLI"DIR "+f$:IFLENf$=1 ANDINSTR("$%&",f$):Path$=""
2200 PROCDrv:Path$=Path$+"."+Dir$:IFLEFT$(Path$,1)=".":Path$=MID$(Path$,2)
2210 ENDPROC
2230 DEFPROCUp:OSCLI"DIR ^":IFINSTR(Path$,"."):REPEATPath$=LEFT$(Path$,LENPath$-1):UNTILRIGHT$(Path$,1)=".":Path$=LEFT$(Path$,LENPath$-1)
2240 ENDPROC
2260 DEFPROCGoto(a$):IFLEFT$(a$,1)="-":I%=INSTR(a$,"-",2):IFI%:a$=MID$(a$,2,I%-2)+":"+MID$(a$,I%+1)
2270 fs$="":I%=INSTR(a$,":",2):IFI%:fs$=LEFT$(a$,I%-1):a$=MID$(a$,I%+1)
2280 fs%=0:OSCLIfs$:OSCLI"Dir "+a$:ENDPROC
2300 DEFPROCdo(A$)
2310 FORz%=0TOn%-1:do%=t%(z%)AND&10000:IFdo%ANDsel%>1:PRINTTAB(0,y%)FNc(1);" "MID$(A$,1-(LEFT$(A$,1)="!"))" "n$(z%)" "a$;SPC(wd%-POS-1)CHR$13;
2320 IFdo%:IFLEFT$(A$,1)="!":A%=EVAL("FN"+MID$(A$,2))ELSEIFdo%:OSCLIA$+" "+n$(z%)+" "+a$
2330 NEXT:IFsel%>1:PRINTSPC(wd%-POS-1)CHR$13;
2340 ENDPROC
2360 DEFFNStamp:OSCLI"Stamp "+n$(z%):PROCSetDate:=0
2370 DEFFNtype(a$):a$=FNu(a$):IFa$="TEXT":="FFF"
2380 IFa$="EXEC":="FFE"
2390 IFa$="DATA":="FFD"
2400 IFa$="BASIC":="FFB"
2410 IFa$="FONT":="FF7"
2420 IFa$="TELETEXT":="F7C"
2430 IFa$="ROM":="BBC"
2440 =a$
2450 DEFFNSetType:X%!2=&FFF00000+&100*EVAL("&"+a$):A%=FNfile(n$(z%),2)
2460 X%!6=e%(z%):X%!14=a%(z%):IFa$="FFE"ORa$="FF7":X%!6=-1:A%=FNfile(n$(z%),3)
2470 PROCSetDate:=0
2480 DEFPROCSetDate:IF(t%(z%)AND&FF)=2:X%!2=-1:X%!6=-1
2490 IFX%?5<>&FF OR (X%?4 AND&F0)<>&F0:ENDPROC
2500 IF(X%!2 AND&FFFFFF)>&FF0000 AND(X%!2 AND&FFFFFF)<&FF8000:ENDPROC
2510 IF(X%!2 AND&FFFF00)=&FFDD00:ENDPROC
2520 IF(X%!15 AND&FF1F)=0:ENDPROC
2530 dy%=X%?15 AND31:mn%=X%?16 AND15:yr%=1981+(X%?16 DIV16)+(X%?15 AND&E0)/2
2540 PROCConvDate(data%,dy%,mn%,yr%,0,0,0,0)
2550 X%!6=!data%:X%?2=data%?4:A%=FNfile(n$(z%),1):ENDPROC
2560 DEFPROCConvDate(mem%,d%,m%,y%,hr%,mn%,sc%,cs%):IFy%<100:y%=y%+1900
2570 y%=y%MOD400
2580 d%=y%*365.25+m%*30+d%+VALMID$("120112234455",m%,1)+((y%MOD4)=0)-((y%-1)DIV100)-(m%>2AND((y%MOD4)=0AND(y%MOD100)<>0ORy%=0))+36493
2590 IFd%>146096:d%=d%-146097
2600 d%=d%*&41EB:mem%!1=d%+d%:d%=((hr%*60+mn%)*60+sc%)*100+cs%
2610 ?mem%=d%:mem%!1=mem%!1+d%DIV256:ENDPROC
2630 DEFFNRename:OSCLI"Rename "+n$(z%)+" "+a$+"."+n$(z%):=0
2650 DEFFNCopy:IFFNfile(a$,5)=2:OSCLI"Copy "+n$(z%)+" "+a$+"."+n$(z%) ELSE OSCLI"Copy "+n$(z%)+" "+a$
2660 IFMv%:OSCLI"Delete "+n$(z%)
2670 =0
2690 DEFPROCCopy(Mv%):IFa$="":a$=w$:PRINTTAB(10+LENf$,y%)a$;:INPUT" "A$:IFA$<>"":ENDPROC
2700 IFMv%ANDINSTR(a$,":")=0:PROCdo("!Rename"):ENDPROC
2710 IFsel%>1OR(t%(ptr%)AND&FF)<>2:PROCdo("!Copy"):ENDPROC
2720 PROCCall("TreeCopy",Tr$,f$+" "+a$+"."+f$+" A~C"+LEFT$("~",1+Mv%)+"DEF~PR~S"):ENDPROC