home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / pckermit / pckget.bas < prev    next >
BASIC Source File  |  2020-01-01  |  2KB  |  52 lines

  1. 5  'Run this program on the PC in conjunction with a Fortran program on the
  2. 6  ' mainframe to get Kermit to the PC
  3. 7  ' Daphne Tzoar , December 1983
  4. 8  ' Columbia University Center for Computing Activities
  5. 9  '
  6. 10 OPEN "com1:4800,n,8,1" AS #1        ' Clear the port status.
  7. 20 CLOSE #1
  8. 30 OPEN "com1:4800,n,8,1,cs,ds,cd" AS #1
  9. 40 OPEN "KERMIT.EXE" FOR OUTPUT AS #2
  10. 50 OK$ = "ok"
  11. 60 PRINT#1,OK$           ' Tell host we're ready for data
  12. 70 X$=INPUT$(63,#1)        ' Data plus semi-colon
  13. 80 VALUE$ = LEFT$(X$,1)      'First char of input
  14. 90 VALUE = ASC(VALUE$)
  15. 100 IF VALUE = 64 OR VALUE = 192 GOTO 430    ' @ means we're done
  16. 110 IF VALUE >= 176 AND VALUE <= 191 THEN GOTO 140   ' Kill all illegal chars
  17. 120 IF VALUE >= 48 AND VALUE <= 63 THEN GOTO 140
  18. 130 X$ = MID$(X$,2) : GOTO 80
  19. 140 IF VALUE <> 174 GOTO 210     ' Not a dot (for read) - don't worry
  20. 150 TWO$ = MID$(X$,2,1)          ' Look at char after the dot.
  21. 160 TWO = ASC(TWO$)
  22. 170 IF TWO >= 176 AND TWO <= 191 THEN GOTO 210    ' It's ok.
  23. 180 IF TWO >= 48 AND TWO <= 63 THEN GOTO 210
  24. 190 X$ = MID$(X$,3)        ' Kill the char
  25. 200 GOTO 80
  26. 210 SIZ = LEN(X$)           ' How much input was actual data
  27. 220 READIN = 64 - SIZ
  28. 225 IF READIN = 0 GOTO 260
  29. 230 XTWO$=INPUT$(READIN,#1)     ' Get rest of data
  30. 240 X$ = X$ + XTWO$ : X$ = LEFT$(X$,62)
  31. 250 PRINT X$         ' Optional - use this line to follow the transmission
  32. 260 GOSUB 290
  33. 270 PRINT#2,X$;      ' Put data to the file.
  34. 280 GOTO 60
  35. 290 ' GET TWO CHARS, SUBTRACT SPACE (20 HEX) FROM EACH, AND COMBINE
  36. 300 ' TO ONE DIGIT.
  37. 310 FOR A = 1 TO 31
  38. 320 Y$ = MID$(X$,A,1)
  39. 330 Z$ = MID$(X$,A+1,1)
  40. 340 YNUM = ASC(Y$) : ZNUM = ASC(Z$)
  41. 350 IF YNUM > 127 THEN YNUM = YNUM - 128    ' Turn off hi bit if on
  42. 360 IF ZNUM > 127 THEN ZNUM = ZNUM - 128
  43. 370 YNUM = YNUM -48 : ZNUM = ZNUM -48       ' Subtract the space
  44. 380 XNUM = (16 * YNUM) +ZNUM
  45. 390 NEWCHR$ = CHR$(XNUM)
  46. 400 X$ = MID$(X$,1,A-1) + NEWCHR$ + MID$(X$,A+2)
  47. 410 NEXT A
  48. 420 RETURN
  49. 430 PRINT  " [All done.]"
  50. 440 CLOSE #1,#2                            ' Clean up.
  51. 450 END
  52.