home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compute! Gazette 1989 December
/
1989-12.d64
/
kterm
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
5KB
|
204 lines
10 rem copyright 1989 compute! publications, inc. - all rights reserved
20 poke53280,14:poke53281,14:poke169,1
30 print"[147]";chr$(14);chr$(8);spc(10);
40 print"[147]":printtab(6)"[195]opyright 1989 [195][207][205][208][213][212][197]!"
50 printtab(8)"[208]ublications, [201]nc."
60 printtab(8)"[193]ll [210]ights [210]eserved":print
70 for jf=1to3000:next:print:print
130 print"[203]ermit [198]ile [212]ransfer":print
140 input"[206]umber of [196]ata [194]its ? 8[157][157][157]";b
150 if b<>7 then open 2,2,0,chr$(6)+chr$(0):b=0
160 if b=7 then open 2,2,0,chr$(38)+chr$(96):b=128
170 open 15,8,15:z$=chr$(0):print
180 gosub420:dim r(255),s(255),n$(143)
190 h(1)=32:h(2)=192:h(3)=64:print
200 for i=0 to 31:s(i)=i:next
210 r(8)=20:r(13)=13:s(20)=8:s=32
220 for j=1 to 3:g=h(j):for i=g to g+31
230 s(i)=s:r(s)=i:s=s+1:next:next
240 def fnc(i)=32+(i+(i and 192)/64 and 63)
250 def fnt(i)=(i or 64)-(i and 64)
260 b$=chr$(20):c$="[175]":print"[144]";c$;
270 get#2,g$:if g$="" then 290
280 g=asc(g$):gosub370:goto270
290 get g$:g=asc(g$+z$):if g=0 then 270
300 if g>132 and g<137 then 330
310 g=s(g):if h then gosub370
320 print#2,chr$(g);:goto270
330 printb$;"":n$="":t$="":e=0
340 on g-132 gosub390,450,760,420
350 print:goto260
360 rem ++ print byte ++
370 printb$;chr$(r(g));c$;:return
380 rem ++ f1, echo ++
390 print"[197]cho: ";mid$("[207]n [207]ff",h+1,3)
400 h=3-h:return
410 rem ++ f7, help ++
420 print"[198]1[146]=[197]cho [198]3[146]=[210]eceive [198]5[146]=[211]end [198]7[146]=[200]elp"
430 return
440 rem ++ f3, receive ++
450 input"[210]eceive: [198]ile [212]ype ? s[157][157][157]";t$
460 if t$="" then return
470 gosub1890:gosub1670:p=4:gosub670
480 if e=0 then gosub1920
490 if e>1 then 630
500 e=0:gosub1320:p=0:p$=""
510 gosub670:if w$="b" then e=2
520 if e then 630
530 gosub2050:i$=i$+","+t$
540 open 8,8,8,i$+",w":gosub2020
550 if e then 620
560 gosub1320:gosub670
570 if w$="z" then e=1
580 if e then 620
590 print#8,i$;
600 if st then e=5:i$="write error"
610 goto550
620 close 8:gosub2020:goto490
630 if e>4 then u$="e"+i$
640 p=0:p$="":if e<>4 then gosub1320
650 goto1150
660 rem ++ receive packet ++
670 for j=1 to 5:x=p:gosub1490
680 printmid$("+o.o",y,1);
690 u$=mid$("yynn",y,1):u=k
700 on y goto730,710,720,720
710 u=k-1 and 63:u$=u$+a$:x=a
720 gosub1320:next:e=4:return
730 k=k+1 and 63:u$=u$+p$
740 a$=p$:a=p:return
750 rem ++ f5, send ++
760 input"[211]end: [215]hich [198]ile(s) ";n$
770 if n$="" then return
780 open 8,8,0,"$:"+n$
790 gosub2020:if e then 910
800 get#8,g$,g$:for n=0 to 143
810 get#8,g$,g$,g$,i$
820 if st then 910
830 n$=str$(asc(g$+z$)+asc(i$+z$)*256)
840 for i=1 to 40:get#8,g$,i$
850 n$=n$+g$+i$:if i$>"" then next
860 t$=mid$(n$,25,1)
870 if t$<>"p" and t$<"s" then 810
880 for i=7 to 23
890 if mid$(n$,i,1)<>chr$(34) then next
900 n$(n)=mid$(n$,7,i-7):next n
910 close 8:gosub2020:if e then 1150
920 print"[206]umber of [198]iles:";n
930 if n=0 then return
940 gosub1890:u$="s"+p$:x=4:gosub1250
950 x=0:if e then 1120
960 gosub1920:f=0
970 e=0:if f=n then e=2:goto1110
980 i$=n$(f):gosub2050
990 u$="f"+i$:gosub1200:if e then 1110
1000 open 8,8,8,n$(f):gosub2020
1010 if e then 1090
1020 u$="":v=0:for i=1 to 96
1030 get#8,g$:g=asc(g$+z$):u$=u$+chr$(g)
1040 if g and b then v=v+1:g=g-b
1050 if g<32 or g=35 or g=q or g=127 then v=v+1
1060 if st then e=1:goto1080
1070 if i+v<p(1) then next
1080 u$="d"+u$:gosub1250:goto1010
1090 if e<3 then u$="z":gosub1200:f=f+1
1100 close 8:gosub2020:if e<2 then 970
1110 if e<3 then u$="b":gosub1200
1120 if e<5 then 1150
1130 u$="e"+i$:gosub1200:i$=mid$(u$,2)
1140 rem ++ end message ++
1150 u$="[195]omplete[210]emote [157][212]imeout [204]ocal"
1160 print:printmid$(u$,e*8-15,8);
1170 if (e and 1)=0 then print:return
1180 gosub2050:print" ";i$:return
1190 rem ++ send string ++
1200 v=0:for i=1 to len(u$)
1210 g=asc(mid$(u$,i,1)+z$)
1220 if g<32 or g=35 or g=q then v=v+1
1230 next
1240 rem ++ send packet ++
1250 for j=1 to 5:u=k:gosub1320
1260 gosub1490
1270 if w$="n" and (y=1 or p) then y=4
1280 printmid$("++.o",y,1);
1290 if y<3 then k=k+1 and 63:return
1300 next:e=4:return
1310 rem ++ put packet ++
1320 i=1:c=66+len(u$)+v+u:gosub1670
1330 if i>p(3) then 1350
1340 print#2,chr$(p(4));:i=i+1:goto1330
1350 print#2,chr$(1);chr$(len(u$)+v+34);chr$(u+32);
1360 for i=1 to len(u$)
1370 g=asc(mid$(u$,i,1)):if x then 1410
1380 if g and b then s=q:gosub1470:g=g-b
1390 if g<32 or g=127 then gosub1450:g=fnt(g):goto1410
1400 if g=35 or g=q then gosub1450
1410 s=g:gosub1470:next
1420 print#2,chr$(fnc(c));chr$(p(5));
1430 return
1440 rem ++ put byte '#' ++
1450 s=35
1460 rem ++ put byte s ++
1470 c=c+s:print#2,chr$(s);:return
1480 rem ++ get packet ++
1490 i$="":y=2:w$="":t=ti+p(2)
1500 get#2,g$:if st and 247 then 1500
1510 if g$<>chr$(1) and ti<t then 1500
1520 c=0:if g$<>chr$(1) then 1650
1530 gosub1700:if y then 1650
1540 d=g-32:gosub1700:if y then 1650
1550 u=g-32:gosub1700:if y then 1650
1560 w$=g$:w=x+1:if d<4 then 1610
1570 for i=4 to d
1580 gosub1700:if y then 1650
1590 on w gosub1750,1800,1830,1860,1780
1600 next
1610 c=-fnc(c):gosub1700:if y then 1650
1620 if c then y=2:w$="":goto1650
1630 gosub1700:if y then 1650
1640 c=u<>k:if w$="e" then e=3
1650 y=y+1:if c then y=y+1
1660 rem ++ clear input buffer ++
1670 get#2,g$:if g$="" then return
1680 goto1670
1690 rem ++ get byte ++
1700 get#2,g$:y=st:if y then 1720
1710 g=asc(g$):c=c+g:return
1720 if y=8 and ti<t then 1700
1730 y=2:w$="":return
1740 rem ++ decode byte ++
1750 if g=p(6) then w=2:return
1760 if g=q then w=3:return
1770 rem ++ add byte ++
1780 i$=i$+chr$(g):return
1790 rem ++ control byte ++
1800 if g<>p(6) and g<>q then g=fnt(g)
1810 i$=i$+chr$(g):w=1:return
1820 rem ++ quoted byte ++
1830 if g=p(6) then w=4:return
1840 i$=i$+chr$(g or 128):w=1:return
1850 rem ++ quoted control byte ++
1860 if g<>p(6) and g<>q then g=fnt(g)
1870 i$=i$+chr$(g or 128):w=1:return
1880 rem ++ initialize parameters ++
1890 k=0:v=0:q=0:i$=""
1900 d$=chr$(112)+"% @-#n"
1910 rem ++ set parameters ++
1920 for i=1 to 7:g$=mid$(i$,i,1)
1930 if g$<"!" then g$=mid$(d$,i,1)
1940 p(i)=asc(g$):next:p(1)=p(1)-36
1950 p(2)=60*(p(2)-32):p(3)=p(3)-32
1960 p(4)=p(4)-32:p(5)=p(5)-32
1970 g=((p(7) and 63)+1 and 63)>32
1980 g$="y":if g then q=p(7):goto2000
1990 if b then g$="&":if p(7)=89 then q=38
2000 p$=chr$(126)+", @-#"+g$:return
2010 rem ++ check drive ++
2020 input#15,g,g$:if g then e=5:i$=g$
2030 return
2040 rem ++ convert i$ ++
2050 g$="":for i=1 to len(i$)
2060 g=asc(mid$(i$,i,1)+z$)
2070 if g>95 then g=g and 95
2080 g$=g$+chr$(g):next:i$=g$:return