10
20 :
30 DIM ctrl% 31,name% 80,mem% &3FFF:X%=ctrl%:Y%=X%DIV256
40 PROCScan:END
50 :
60 DEFPROCScan:LOCAL i%,n%
70 REPEATf$=FNs(FNgbpb8(i%)):i%=X%!9:n%=LENf$:IFn%:PROCFile
80 UNTILn%=0:ENDPROC
90 DEFPROCFile
100 IFASCf$=46 OR ASCf$=45 OR INSTR(f$,"<"):ENDPROC
110 IFFNfile(f$,5)=2:OSCLI"Dir "+f$:PROCScan:OSCLI"Dir ^":ENDPROC
120 A%=X%!3AND&FFF
130 IFA%=&FAF OR A%=&FFB OR A%=&FFF:ENDPROC
140 L%=X%!10:IFL%>&4000:ENDPROC
150 OSCLI"LOAD "+f$+" "+STR$~mem%
160 :
170 A%=9:title$="":REPEAT:IF mem%?A%>31:title$=title$+CHR$mem%?A%
180 A%=A%+1:UNTIL mem%?A%<32 OR mem%?A%>126 OR A%>63:title$=FNs(title$)
190 ver$="":REPEAT:IF mem%?A%>31:ver$=ver$+CHR$mem%?A%
200 A%=A%+1:UNTIL mem%?A%<32 OR mem%?A%>126 OR A%>127:ver$=FNs(ver$)
210 A%=mem%?7:copy$="":REPEAT:IF mem%?A%>31:copy$=copy$+CHR$mem%?A%
220 A%=A%+1:UNTIL mem%?A%<32 OR mem%?A%>126 OR A%>255:copy$=FNs(copy$)
230 IF LEFT$(copy$,3)<>"(C)":ver$=RIGHT$(f$,4)
240 IF ver$=copy$:ver$=""
250 IF ver$="":A%=INSTR(title$,"."):ver$=MID$(title$,A%-1,4):title$=LEFT$(title$,A%-2)
260 IF ver$="":ver$=LEFT$(STR$~mem%?8+"00",3)
270 IF FNuc(LEFT$(ver$,7))="VERSION":ver$=FNs(MID$(ver$,8))
280 IF FNuc(LEFT$(ver$,1))="V":ver$=FNs(MID$(ver$,2))
290 IF LEFT$(ver$,1)>"9":A%=INSTR(ver$,"."):IFA%:ver$=MID$(ver$,A%-1,4)
300 IF LEFT$(ver$,1)>"9":ver$=MID$(ver$,2)
310 IF MID$(ver$,2,1)="-":ver$=LEFT$(ver$,1)+"."+MID$(ver$,3)
320 IF MID$(ver$,2,1)>"9":ver$=LEFT$(ver$,1)+MID$(ver$,3)
330 ver$=FNs(ver$)
340 IF MID$(ver$,2,1)<>".":ver$=LEFT$(ver$,1)+"."+MID$(ver$,2)
350 IF LENver$<5:ver$=LEFT$(ver$+"00",4)
360 IF MID$(ver$,3,1)<"0" AND MID$(ver$,3,1)>"0":ver$=LEFT$(ver$,2)+"0"+MID$(ver$,3)
370 IF MID$(ver$,4,1)<"0" AND MID$(ver$,4,1)>"0":ver$=LEFT$(ver$,3)+"0"+MID$(ver$,3)
380 copy$=LEFT$(copy$,3)+FNs(MID$(copy$,4))
390 IF LENtitle$<3:title$=f$
400 :
410 A%=mem%:pr%=TRUE:REPEAT
420 IF FNchk1:PROCpr:PRINT;~A%-mem%+&8000;": LDA &EF ";title$;" ";ver$
430 IF FNchk2:PROCpr:PRINT;~A%-mem%+&8002;": CMP #&";FNh0(A%?3,2);" ";title$;" ";ver$
440 IF FNchk3:PROCpr:PRINT;~A%-mem%+&8002;": SBC #&";FNh0(A%?3,2);" ";title$;" ";ver$
450 IF FNchk4:PROCpr:PRINT;~A%-mem%+&8002;": BPL xxxx ";title$;" ";ver$
460 IF FNchk5:PROCpr:PRINT;~A%-mem%+&8002;": BMI xxxx ";title$;" ";ver$
470 A%=A%+1:UNTILA%>=mem%+L%:IF pr%=FALSE:PRINT
480 ENDPROC
490 :
500 DEFPROCpr:IF pr%:PRINT f$:pr%=FALSE
510 ENDPROC
520 DEFFNchk1:IF?A%=&A5:IFA%?1=&EF:=TRUE:
530 =FALSE
540 DEFFNchk2:IF?A%=&A5:IFA%?1=&EF:IFA%?2=&C9:=TRUE:
550 =FALSE
560 DEFFNchk3:IF?A%=&A5:IFA%?1=&EF:IFA%?2=&E9:=TRUE:
570 =FALSE
580 DEFFNchk4:IF?A%=&A5:IFA%?1=&EF:IFA%?2=&10:=TRUE:
590 =FALSE
600 DEFFNchk5:IF?A%=&A5:IFA%?1=&EF:IFA%?2=&30:=TRUE:
610 =FALSE
620 :
630 DEFFNuc(A$):LOCAL B$:IFA$="":=""
640 REPEATB$=B$+CHR$(ASCA$AND((A$<"@")OR&DF)):A$=MID$(A$,2):UNTILA$="":=B$
650 DEFFNs(A$):IFLEFT$(A$,1)=" ":REPEATA$=MID$(A$,2):UNTILLEFT$(A$,1)<>" "
660 IFRIGHT$(A$,1)=" ":REPEATA$=LEFT$(A$,LENA$-1):UNTILRIGHT$(A$,1)<>" "
670 =A$
680 DEFFNh0(A%,N%)=RIGHT$("0000000"+STR$~A%,N%)
690 DEFFNd(A%,N%)=RIGHT$(" "+STR$A%,N%)
700 DEFFNfile(A$,A%):$name%=A$:?X%=name%:X%?1=name%DIV256:=(USR&FFDD)AND&FF
710 DEFPROCgbpb(A%,chn%,addr%,num%,ptr%):?X%=chn%:X%!1=addr%:X%!5=num%:X%!9=ptr%:CALL &FFD1:ENDPROC
720 DEFFNgbpb(A%):X%!1=name%:CALL&FFD1:A%=name%+((1+?name%)AND((A%AND-2)=6))
730 A%?(1+?A%)=13:=$(A%+1)
740 DEFFNgbpb8(ptr%):X%!1=name%:X%!5=1:X%!9=ptr%:A%=8:CALL&FFD1:IFX%!5=1:=""
750 A%=name%:A%?(1+?A%)=13:=$(A%+1)
760 DEFFNargs(A%,Y%,ptr%):LOCAL X%,E%:IF?(TOP-3)=0:E%=Y%:Y%=0
770 IFPAGE<&8000:LOCAL !&70:X%=&70:!X%=ptr%:CALL&FFDA:=!X%
780 SYS"OS_Args",A%,Y%,ptr% TO ,,ptr%:=ptr%
790 DEFFNargsA(A%):IFPAGE<&8000:LOCAL X%,Y%,E%,!&70:X%=&70:=(USR&FFDA)AND&FF
800 SYS"OS_Args",A% TO A%:=A%
810 DEFFNfs:LOCAL A%,Y%,E%:=(USR&FFDA)AND&FF