home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Columbia Kermit
/
kermit.zip
/
archives
/
c64cross.tar.gz
/
c64cross.tar
/
c64boot.bas
< prev
next >
Wrap
BASIC Source File
|
1992-10-01
|
3KB
|
79 lines
10 rem file capture program; robert lenoil, author.
15 rem written december 1984. cleaned up for general public february 1985.
20 rem many fixes and additions august 1992, by matt sorrels.
25 print chr$(147); chr$(14); "Now in dumb terminal mode. Press F1 key";
30 print "to begin receiving file. (Make sure that";
35 print "host is set for half-duplex.) Press F7"
40 print "key to exit program.
45 print "----------------------------------------";
50 open 1,2,0,chr$(6) + chr$(0) : open 15,8,15
55 dim hx(22)
60 for i = 0 to 9 : hx(i) = i : next i : for i = 10 to 16 : hx(i) = 0 : next i
65 for i = 17 to 22 : hx(i) = i - 7 : next i
70 get a$ : if a$ = "" then 90
75 if a$ = chr$(133) then 105
80 if a$ = chr$(136) then print "Quitting" : close 1 : end
85 gosub 275 : print#1,a$;
90 get#1,a$ : gosub 170
95 if a$ <> "" then print a$;
100 goto 70
105 f$ = "" : print : input "Local filename"; f$
110 if f$ = "" then close 15 : close 1 : print "Quitting" : end
115 open 8,8,8,"0:" + f$ + ",p,w"
120 gosub 150 : if en$ > "00" then close 8 : goto 100
125 fi = 0
130 get#1,a$ : if a$ > "" then 130
135 gosub 140 : goto 195
140 print#1,"ok" : return : rem "ok" on remote host -- must be lower case
145 print#1,"ng" : return : rem "ng" on remote host -- must be lower case
150 if st = 0 then en$ = "00" : return
155 input#15,en$,em$,et$,es$
160 if en$ > "00" then print chr$(18); en$; em$; et$; es$
165 return
170 rem convert ascii to petascii
175 a = asc(a$ + chr$(0)) : if a > 64 and a < 91 then a = a + 128
180 if a > 96 and a < 123 then a = a - 32
185 if a = 127 then a = 20
190 a$ = chr$(a) : return
195 l$ = "" : ck = 0
200 get#1,a$ : if a$ = "" then 200
205 if a$ = chr$(10) then 215
210 ck = ck + asc(a$) : gosub 170 : l$ = l$ + a$ : goto 200
215 ck$ = ""
220 get#1,a$ : if a$ = "" then 220
225 if a$ <> chr$(10) then ck$ = ck$ + a$ : goto 220
230 if ck = abs(val(ck$)) then 245
235 print chr$(13); chr$(18); "Checksum Error - sending nack"
240 gosub 145 : goto 195
245 if l$ = "" then 255
250 gosub 295
255 if val(ck$) <= 0 then 265
260 print"."; : gosub140 : goto 195
265 close 8 : print chr$(13); f$; " downloaded; returning to terminal mode"
270 goto 70
275 a = asc(a$+chr$(0))
280 if a > 192 and a < 219 then a = a - 128 : goto 290
285 if a > 64 and a < 91 then a = a + 32
290 a$ = chr$(a) : return
295 if fi <> 1 then gosub 360
300 h1$ = mid$(l$,2,1) : h2$ = mid$(l$,3,1) : gosub 390 : i = h * 2
305 h1$ = mid$(l$,4,1) : h2$ = mid$(l$,5,1) : gosub 390 : ck = h
310 h1$ = mid$(l$,6,1) : h2$ = mid$(l$,7,1) : gosub 390 : ck = ck + h
315 if i = 0 then return
320 for j = 0 to i - 5 step 2
325 h1$ = mid$(l$,j + 8,1) : h2$ = mid$(l$,j + 9,1) : gosub 390
330 print#8,chr$(h); : if st <> 0 then gosub 150 : stop
335 ck = ck + h : next j
340 h1$ = mid$(l$,i + 4,1) : h2$ = mid$(l$,i + 5,1) : gosub 390 : rk = h * 256
345 h1$ = mid$(l$,i + 6,1) : h2$ = mid$(l$,i + 7,1) : gosub 390 : rk = rk + h
350 if ck = rk then return
355 print chr$(13); chr$(18); "Data file bad." : close 8 : close 1 : end
360 rem write out the start address
365 h1$ = mid$(l$,6,1) : h2$ = mid$(l$,7,1) : gosub 390 : print#8,chr$(h);
370 if st <> 0 then gosub 150 : stop
375 h1$ = mid$(l$,4,1) : h2$ = mid$(l$,5,1) : gosub 390 : print#8,chr$(h);
380 if st <> 0 then gosub 150 : stop
385 fi = 1 : return
390 h = hx(asc(h1$) - 48) * 16 + hx(asc(h2$) - 48)
395 return