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

  1. 1    'Use this BASIC program on the Amiga if you have the printable file 
  2. 2    'CKIKER.BOO already on the Amiga to convert it to an executable
  3. 3    'file.  This program takes about 45 minutes to run on an Amiga with
  4. 4    'floppy disks.
  5. 5    ' Bill Catchings, June 1984
  6. 6    ' Columbia University Center for Computing Activities, New York
  7. 7    ' Slightly modified for Microsoft Amiga Basic by Stephen Walton,
  8. 8    ' California State University Northridge, November 1989.
  9.  
  10. 9    CLEAR ,50000&
  11. 10   t$ = TIME$    ' Save the time.
  12. 20   DEFINT a-z    ' Integer to gain some speed.
  13. 25   b$ = "CKIKER.BOO"                  ' Name of input .BOO file.
  14. 30   n$ = CHR$(0)
  15. 40   z = ASC("0")
  16. 50   t = ASC("~")-z
  17. 60   DEF FNuchr%(a$)=ASC(a$)-z
  18. 70   OPEN b$ FOR INPUT AS #1
  19.  
  20. 100  INPUT#1,f$    ' Is this the right file?
  21. 110  IF LEN(f$) > 20 THEN GOTO 900
  22. 120  OPEN f$ FOR OUTPUT AS #2
  23. 130  PRINT "Outputting to "+f$
  24.  
  25. 200  IF EOF(1) THEN GOTO 800  ' Exit nicely on end of file.
  26. 210  INPUT#1,x$    ' Get a line.
  27. 220  y$ = ""    ' Clear the output buffer.
  28. 230  GOTO 400
  29.  
  30. 300  PRINT#2,y$;   ' Print output buffer to file.
  31. 310  GOTO 200    ' Get another line.
  32.  
  33. 400  IF LEN(x$) < 2 GOTO 300  ' Is the input buffer empty?
  34. 410  a = FNuchr%(x$)
  35. 420  IF a = t THEN GOTO 700  ' Null repeat character?
  36. 430  IF LEN(x$) < 3 GOTO 300  ' Is the input buffer empty?
  37. 440  q$=MID$(x$,2,3)   ' Get the quadruplet to decode.
  38. 450  x$=MID$(x$,5)
  39. 460  b = FNuchr%(q$)
  40. 470  q$ = MID$(q$,2)
  41. 480  c = FNuchr%(q$)
  42. 490  q$ = MID$(q$,2)
  43. 500  d = FNuchr%(q$)
  44.  
  45. 600  y$ = y$ + CHR$(((a * 4) + (b \ 16)) AND 255) ' Decode the quad.
  46. 610  y$ = y$ + CHR$(((b * 16) + (c \ 4)) AND 255)
  47. 620  y$ = y$ + CHR$(((c * 64) + d) AND 255)
  48. 630  GOTO 400    ' Get another quad.
  49.  
  50. 700  x$ = MID$(x$,2)   ' Expand the nulls.
  51. 710  r = FNuchr%(x$)   ' Get the number of nulls.
  52. 715 PRINT " Null: ",r
  53. 720  x$ = MID$(x$,2)
  54. 730   FOR i=1 TO r   ' Loop, adding nulls to string.
  55. 740   y$ = y$ + n$
  56. 750   NEXT
  57. 760  PRINT#2,y$;   ' Output the nulls to the file.
  58. 770  y$ = ""    ' Clear the output buffer.
  59. 780  GOTO 400
  60.  
  61. 800  PRINT "Processing complete, elapsed time: "+t$+" to "+TIME$
  62. 810  PRINT "Output in "+f$
  63. 820  CLOSE #1,#2
  64. 830  GOTO 9999
  65.  
  66. 900  PRINT b$ " does not seem to be in .BOO format."
  67. 910  GOTO 820
  68.  
  69. 9999 END
  70.