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

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