xmodem client

Type in and save this for the download client. If you are not using Proofreader, ignore the first 2 characters at the start of each line.

CCGMS-Emer Main page

BA 100 rem ++ xmodem file transfer ++
JE 105 poke 53280,11:poke 53281,11:gosub 290
RM 110 open 2,2,0,chr$(br)+chr$(0):m=255
CE 115 g$=chr$(20):u$=chr$(175)
FB 120 z$=chr$(0):open 15,8,15
XE 125 print chr$(144);chr$(147);chr$(14);
GG 130 print chr$(8);spc(10);
CE 135 print “XMODEM CCGMS DOWNLOADER”:print
EQ 140 gosub 275:dim r(255),s(255)
SE 145 for b=0 to 31:s(b)=b:next:r(8)=20
DK 150 r(13)=13:s(20)=8:for b=32 to 64
EJ 155 r(b)=b:s(b)=b:next:s(160)=32
RF 160 for b=65 to 90:i=b+128:r(b)=i
ED 165 s(i)=b:next:for b=91 to 96:r(b)=b
ER 170 s(b)=b:next:for b=97 to 122:i=b-32
AK 175 r(b)=i:s(i)=b:next:for b=123 to 127
EB 180 i=b+96:r(b)=i:s(i)=b:next
HE 185 print chr$(152);u$;
CQ 190 get#2,b$:if b$=”” then 200
EB 195 b=asc(b$):gosub 245:goto 190
BS 200 get b$:if b$=”” then 190
XK 205 b=asc(b$)
MQ 210 if b>132 and b<137 then 230 KF 215 b=s(b):print#2,chr$(b); HK 220 if h then gosub 250 KE 225 goto 190 FM 230 print g$:print chr$(144); BF 235 on b-132 gosub 260,415 MH 240 goto 185 HC 245 rem ++ print byte ++ DB 250 print g$;chr$(r(b));u$;:return FB 255 rem ++ f1, echo ++ QK 260 print "ECHO: ";mid$("ONOFF",h+1,3) MS 265 h=3-h:return CR 270 rem ++ f7, help ++ BK 275 print "F1=ECHO F3=RECEIVE" MJ 280 return QA 285 rem ++ change baud ++ AG 290 print "“select baud rate" XA 300 print "note: use 300 baud unless you need to access your modem" SF 310 print "at a different speed if it currently is defaulted to" RG 320 print "a different speed than 300. Faster than 300 baud will" DX 330 print "not be very reliable." JC 340 print "1) 300 Baud" MD 341 print "2) 1200 baud" BA 342 print "3) 2400 baud" GP 343 print "these only will be possible with a swiftlink-type modem," BF 344 print "and the swiftlink driver patch installed" SX 345 print "4) 9600 baud" XH 346 print "5) 19200 baud" HE 347 print "6) 38400 baud" XJ 348 print "7) 57600 baud" JK 349 input "which baud";br$ AJ 351 if br$="1" then br=6:return GH 352 if br$="2" then br=8:return GQ 353 if br$="3" then br=10:return JH 363 if br$="4" then br=14:return QC 373 if br$="5" then br=15:return EA 382 if br$="6" then br=16:return EX 386 if br$="7" then br=17:return HA 388 goto 290 GQ 390 rem ++ get control byte100 sec ++ SB 395 for j=1 to 10:gosub 510 DC 400 if e then next:a=24:f=2 RA 405 return CG 410 rem ++ f3, receive file ++ JP 415 print "STARTING XMODEM DOWNLOAD":b$="W":a=21 DA 420 gosub 675:if f then return RK 425 c$=chr$(1)+chr$(4) FJ 430 for k=1 to m+1:k=k and m XE 435 if f then 470 SP 440 for j=1 to 10:gosub 485:a=21 MR 445 gosub 510 DE 450 if c=1 then gosub 550:print mid$("+O",e+1,1); GJ 455 if c=2 then a=6:f=1 EP 460 if e and f=0 then next:a=24:f=2 KF 465 next k FP 470 print:close 8:gosub 700 RR 475 gosub 485:goto 715 FM 480 rem ++ send answer byte ++ DX 485 gosub 495:print#2,chr$(a);:return BB 490 rem ++ clear input buffer ++ XD 495 get#2,b$:if (st and 8)=0 then 495 QF 500 return EC 505 rem ++ get control byte 10 sec ++ XE 510 e=0:p=600:t=ti PK 515 c=3:gosub 620 MH 520 if e then print ".";:return AK 525 if b$=chr$(24) then a=24:f=4:return KD 530 for c=1 to len(c$) EX 535 if b$=mid$(c$,c,1) then return BH 540 next:gosub 650:goto 515 MM 545 rem ++ get data ++ HB 550 p=60:t=ti:gosub 620:if e then return PH 555 n=b:t=ti:gosub 620:if e then return BB 560 if n+b<>m then e=1:goto 650
BJ 565 s=0:d$=””:for i=1 to 128
AF 570 t=ti:gosub 620:if e then return
FE 575 d$=d$+chr$(b):s=s+b:next
EG 580 t=ti:gosub 620:if e then return
AC 585 if b<>(s and m) then e=1:got0 650
SK 590 a=6:d=k-n and m
XF 595 if d>1 then a=24:f=3
SQ 600 if d then e=1:return
FJ 605 print#8,d$;:if st then a=24:f=5
PQ 610 return
DA 615 rem ++ get byte ++
QP 620 get#2,b$:w=st:if w then 630
KD 625 b=asc(b$+z$):return
SF 630 if w and 247 then gosub 650
GC 635 if ti>t+p then e=1:return
HQ 640 goto 620
ME 645 rem ++ skip until silence ++
QD 650 u=ti
GK 655 get#2,b$:if st<>8 then 650
SG 660 if ti>u+60 then return
BF 665 goto 655
PJ 670 rem ++ transfer begin ++
JE 675 f=0
PG 680 open 8,8,8,”0:ccgms,p,w”
BK 695 rem ++ read error channel ++
RK 700 input#15,i,m$:if i=0 then return
KM 705 print””;m$:a=24:f=5:close 8:return
MJ 710 rem ++ transfer end ++
FD 715 m$=”COMPLETETIMEOUT DISORDERCANCEL”
KF 720 print mid$(m$,f*8-7,8):return