home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / c64cross / c64boot.bas < prev    next >
BASIC Source File  |  2020-01-01  |  3KB  |  79 lines

  1. 10 rem file capture program; robert lenoil, author.
  2. 15 rem written december 1984. cleaned up for general public february 1985.
  3. 20 rem many fixes and additions august 1992, by matt sorrels.
  4. 25 print chr$(147); chr$(14); "Now in dumb terminal mode.  Press F1 key";
  5. 30 print "to begin receiving file. (Make sure that";
  6. 35 print "host is set for half-duplex.)  Press F7"
  7. 40 print "key to exit program.
  8. 45 print "----------------------------------------";
  9. 50 open 1,2,0,chr$(6) + chr$(0) : open 15,8,15
  10. 55 dim hx(22)
  11. 60 for i = 0 to 9 : hx(i) = i : next i : for i = 10 to 16 : hx(i) = 0 : next i
  12. 65 for i = 17 to 22 : hx(i) = i - 7 : next i
  13. 70 get a$ : if a$ = "" then 90
  14. 75 if a$ = chr$(133) then 105
  15. 80 if a$ = chr$(136) then print "Quitting" : close 1 : end
  16. 85 gosub 275 : print#1,a$;
  17. 90 get#1,a$ : gosub 170
  18. 95 if a$ <> "" then print a$;
  19. 100 goto 70
  20. 105 f$ = "" : print : input "Local filename"; f$
  21. 110 if f$ = "" then close 15 : close 1 : print "Quitting" : end
  22. 115 open 8,8,8,"0:" + f$ + ",p,w"
  23. 120 gosub 150 : if en$ > "00" then close 8 : goto 100
  24. 125 fi = 0
  25. 130 get#1,a$ : if a$ > "" then 130
  26. 135 gosub 140 : goto 195
  27. 140 print#1,"ok" : return : rem "ok" on remote host -- must be lower case
  28. 145 print#1,"ng" : return : rem "ng" on remote host -- must be lower case
  29. 150 if st = 0 then en$ = "00" : return
  30. 155 input#15,en$,em$,et$,es$
  31. 160 if en$ > "00" then print chr$(18); en$; em$; et$; es$
  32. 165 return
  33. 170 rem convert ascii to petascii
  34. 175 a = asc(a$ + chr$(0)) : if a > 64 and a < 91 then a = a + 128
  35. 180 if a > 96 and a < 123 then a = a - 32
  36. 185 if a = 127 then a = 20
  37. 190 a$ = chr$(a) : return
  38. 195 l$ = "" : ck = 0
  39. 200 get#1,a$ : if a$ = "" then 200
  40. 205 if a$ = chr$(10) then 215
  41. 210 ck = ck + asc(a$) : gosub 170 : l$ = l$ + a$ : goto 200
  42. 215 ck$ = ""
  43. 220 get#1,a$ : if a$ = "" then 220
  44. 225 if a$ <> chr$(10) then ck$ = ck$ + a$ : goto 220
  45. 230 if ck = abs(val(ck$)) then 245
  46. 235 print chr$(13); chr$(18); "Checksum Error - sending nack"
  47. 240 gosub 145 : goto 195
  48. 245 if l$ = "" then 255
  49. 250 gosub 295
  50. 255 if val(ck$) <= 0 then 265
  51. 260 print"."; : gosub140 : goto 195
  52. 265 close 8 : print chr$(13); f$; " downloaded; returning to terminal mode"
  53. 270 goto 70
  54. 275 a = asc(a$+chr$(0))
  55. 280 if a > 192 and a < 219 then a = a - 128 : goto 290
  56. 285 if a > 64 and a < 91 then a = a + 32
  57. 290 a$ = chr$(a) : return
  58. 295 if fi <> 1 then gosub 360
  59. 300 h1$ = mid$(l$,2,1) : h2$ = mid$(l$,3,1) : gosub 390 : i = h * 2
  60. 305 h1$ = mid$(l$,4,1) : h2$ = mid$(l$,5,1) : gosub 390 : ck = h
  61. 310 h1$ = mid$(l$,6,1) : h2$ = mid$(l$,7,1) : gosub 390 : ck = ck + h
  62. 315 if i = 0 then return
  63. 320 for j = 0 to i - 5 step 2
  64. 325 h1$ = mid$(l$,j + 8,1) : h2$ = mid$(l$,j + 9,1) : gosub 390
  65. 330 print#8,chr$(h); : if st <> 0 then gosub 150 : stop
  66. 335 ck = ck + h : next j
  67. 340 h1$ = mid$(l$,i + 4,1) : h2$ = mid$(l$,i + 5,1) : gosub 390 : rk = h * 256
  68. 345 h1$ = mid$(l$,i + 6,1) : h2$ = mid$(l$,i + 7,1) : gosub 390 : rk = rk + h
  69. 350 if ck = rk then return
  70. 355 print chr$(13); chr$(18); "Data file bad." : close 8 : close 1 : end
  71. 360 rem write out the start address
  72. 365 h1$ = mid$(l$,6,1) : h2$ = mid$(l$,7,1) : gosub 390 : print#8,chr$(h);
  73. 370 if st <> 0 then gosub 150 : stop
  74. 375 h1$ = mid$(l$,4,1) : h2$ = mid$(l$,5,1) : gosub 390 : print#8,chr$(h);
  75. 380 if st <> 0 then gosub 150 : stop
  76. 385 fi = 1 : return
  77. 390 h = hx(asc(h1$) - 48) * 16 + hx(asc(h2$) - 48)
  78. 395 return
  79.