Mark Wickens

10 MODE8:DEFSEG=0:GOTO110
20 GOSUB20
30 OPENp$ FORINPUTAS#1:IFASC(INPUT$(1,1))<>2 THENCLOSE:GOTO30 ELSERETURN
50 IFg$="" THENRETURN ELSEGOSUB70:FORk=1 TOLEN(g$):k$=MID$(g$,k,1):MODE32(k$):NEXT:g$="":FORl=0 TOk-2:g$=g$+CHR$(PEEK(l+768)):NEXT:RETURN
70 POKE768,0:POKE769,0:POKE1608,0:POKE1609,3:RETURN
90 n=PEEK(e):e=e-1:RETURN
110 n$="":a=2:a$="":j$="":i=0:p$="":m=512:f$="":c$="":o=0:g=0:e=0:d=0:e$=""
120 p=0:b$="":k=0:g$="":c=0:w=0:u=0:v=0:s=0:o$="":i$="":q=0:h$="":r=0:m$="":k$="":h=0:f=0:t=0:l=0:b=0:x=0:y=0:n=0:d$=""
200 IFPEEK(m)=32 THENm=m+1:GOTO200
210 IFPEEK(m)=4 ANDPEEK(m+1)=180 THENf$="VF":GOSUB2190:GOSUB2120:GOSUB2220:GOTO410
220 IFPEEK(m)<>4 ORPEEK(m+1)<>179 THENa
230 n=PEEK(m+a):IFn=32 THENa=a+1:GOTO230
240 IFn=0 ORn=34 ORn=48 ORn=49 THENf$="PF":GOSUB2190:GOSUB2120:GOSUB2220:GOTO410
250 IFn=7 ANDPEEK(m+a+1)=187 THENf$="AF":a=a+2:GOSUB2190:GOSUB2120:GOSUB2220:GOTO410
260 IFn=35 THENf$="MF":a=a+1:GOSUB2190:GOSUB2120 ELSEa
270 n=PEEK(m+a)
280 IFn=0 THENg=0:GOTO410
290 IFn=32 THENa=a+1:GOTO270
300 IFn=44 THENa=a+1:GOSUB2250:IFn=77 THENg=1:GOSUB2220 ELSEa ELSEa
410 a=1709:o=(PEEK(a+1))*256+(PEEK(a))-1:f=o:e=o:h=o-FRE(1)+1
430 FORd=1867 TO1874:e$=e$+CHR$(PEEKd):NEXT
460 b$="":a$="":OPENp$ FORINPUTAS#1:p=ASC(INPUT$(1,1)):IFp<144 THENCLOSE:GOTO460
470 b$=INPUT$(10,1):CLOSE
490 IFp MOD16=15 THENa$="":GOTO510
500 FORk=1 TO8:j$=MID$(b$,k,1):IFj$<>CHR$(7) THENa$=a$+j$:NEXT
510 i=ASC(MID$(b$,10)):c=VAL("&h"+MID$(HEX$(p),3,1))-8
520 IFc=<2 THENn$="MF":GOTO560
530 IFc=6 THENn$="VF":GOTO560
540 IFc=3ORc=7 THENn$="AF":GOTO560
550 n$="PF"
560 g$=a$:GOSUB50:b$=g$:PRINTb$;TAB(9);n$;:PRINT
570 IFf$<>n$ THEN460
580 IFc$<>"" ANDc$<>b$ THEN460
600 ONc GOTO810,,,,810,810,810
710 GOSUB30
720 n=ASC(INPUT$(1,1)):IFn=255 ORn=241 THEN730 ELSEd$=d$+CHR$(n):GOTO720
730 CLOSE:g$=d$:GOSUB50:d$=g$
735 IFLEN(d$)>8 THENREAD$
740 IFLEN(d$)<8 THENd$=d$+CHR$(0):GOTO740
750 IFe$=d$ THEN810
760 PASSd$
810 GOSUB30:MODE35(:CLOSE:f=PEEK(1609)*256+PEEK(1608)-1
1010 IFf$="VF" THEN10010 ELSEPRINT"Converting...";
1020 IFf$="MF" THEN6010
1030 IFf$="PF" THEN1140
1110 w=48:o$=HEX$(PEEK(1715)+PEEK(1716)*256-15):POKE1616,VAL("&h"+RIGHT$(o$,2)):POKE1617,VAL("&h"+LEFT$(o$,2))
1130 FORk=48 TO57:k$=CHR$(k):MODE30(k$):NEXT:GOTO1160
1140 w=PEEK(PEEK(1611)*256+PEEK(1610)+8):k$=CHR$(w):MODE30(k$)
1160 q=0:x=0:y=0:l=0:GOSUB70:GOSUB2040:u=n:GOSUB90:v=n:o$=RIGHT$(HEX$(v),2)+RIGHT$(HEX$(u),2):o$=MID$(STR$(VAL(o$)),2):s=PEEK(1609)*256+PEEK(1608)
1170 FORk=1 TOLEN(o$):POKE768+k-1,ASC(MID$(o$,k,1)):s=s+1:NEXT:POKE768+k-1,0:i$=HEX$(s):POKE1609,VAL(LEFT$(i$,2)):POKE1608,VAL(RIGHT$(i$,2))
1180 GOSUB90
1182 IFn=255 THEN1240
1184 IFn=254 THENq=0:x=0:y=0:l=0:GOTO1225
1186 IFn=7 THENy=y+1:IFy>=2 THENy=0:l=1:GOTO1225
1188 IFy=1 THEN1225
1190 IFn=167 THENx=1:GOTO1225
1192 IFn*x*l=93 THENn=94:GOTO1223
1194 IFn=165 ORn=151 THENq=SGN(n-151):GOTO1223
1196 IFn*q=94 THENn=151:q=0
1223 l=0
1225 IFPEEK(1608)>=247 THEN5000
1230 h$=CHR$(n):MODE32(h$):GOTO1180
1240 GOSUB2080:MODE31(m$):GOTO1160
2030 IFPEEK(m+a)=44 ANDPEEK(m+a+1)=77 THENg=1:RETURN
2040 e=o
2050 GOSUB90:IFn=224 THENw=w+1:GOTO2050
2060 IFn=240 THENEND ELSERETURN
2080 m$=CHR$(w)
2090 r=e-f:t=o-r+1:MODE33(f+1,t,r):f=t-1:IF(FRE(1))-r<0 THEN20
2100 RETURN
2120 n=PEEK(m+a):IFn=44 ANDf$="MF" THENRETURN
2130 IFn=0 THENRETURN
2140 IFn=32 THENa=a+1:GOTO2120
2150 IFn<>34 THENa ELSEa=a+1
2160 n=PEEK(m+a):IFn=34 THENa=a+1:c$=LEFT$(c$,8):RETURN
2170 IFn=0 THENc$=LEFT$(c$,8):RETURN ELSEc$=c$+CHR$(n):a=a+1:GOTO2160
2190 n=PEEK(m+a):IFn=48 ORn=49 THENp$="PMT"+CHR$(n)+":":a=a+1:RETURN
2195 IFn=32 THENa=a+1:GOTO2190
2200 p$="PMT0:":RETURN
2220 n=PEEK(m+a):IFn=0 THENRETURN
2230 IFn=32 THENa=a+1:GOTO2220 ELSEa
2250 n=PEEK(m+a):a=a+1:IFn=32 THEN2250 ELSERETURN
5000 j$=j$+"ST error":GOTO5000
6010 IFg=1THEN6040
6020 RESTORE#
6030 RESTORE#"",1,6060:WRITE#:GOTO6030
6040 RESTORE#CHR$(26),0,6060:READ$
6060 GOSUB70:e=o
6070 GOSUB90:IFn=240 THENEND
6075 IFPEEK(1608)>=247 THEN5000
6080 IFn<>255 THENh$=CHR$(n):MODE32(h$):GOTO6070
6090 GOSUB2090:k=768:s=256*PEEK(1609)+PEEK(1608):l$=""
6100 IFk=s THENWRITE#l$:GOTO6060 ELSEl$=l$+CHR$(PEEK(k)):k=k+1:GOTO6100
10010 e=o:j=0:a=0:IFi¥16>0 THEN10100
10020 IFa=0 THENPRINT"GET ";(e-f-1)/8;"data";:PRINT:PRINT "Converting...";
10030 IFe<f+5 THENEND
10040 GOSUB70:n=PEEK(e-7):IFn>10 THEN10070
10050 FORk=0 TO7:GOSUB90:POKE768+k,n:NEXT:MODE34("A("+STR$(j)+")"+CHR$(0)):j=j+1:GOTO10030
10070 a=n¥16
10080 FORk=0 TO7:GOSUB90:a=a-1:IFa>=0 THENMODE32(CHR$(n))
10085 NEXT
10090 MODE34("A$("+STR$(j)+")"+CHR$(0)):j=j+1:GOTO10030
10100 GOSUB90:b=n:a=30:IF(i¥16)=14 THENa=62
10110 PRINT"GET $,";(e-f-a-2)/8;"data";:PRINT:PRINT"Converting...";:GOSUB70
10120 FORk=0 TOa:GOSUB90:b=b-1:IFb>=0 THENMODE32(CHR$(n))
10130 NEXT:MODE34("$"+CHR$(0)):GOTO10030