home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / honeywellmicro / hl6tran.bas < prev   
BASIC Source File  |  2020-01-01  |  2KB  |  65 lines

  1. 1    'Use this BASIC program on the PC if you have the printable file 
  2. 2    'MSKERMIT.BOO already on the PC to convert it to an executable
  3. 3    'file.  This program takes about 30 minutes to run on a PC with
  4. 4    'floppy disks.
  5. 5    ' Bill Catchings, June 1984
  6. 6    ' Columbia University Center for Computing Activities
  7.  
  8. 10   t$ = time$                ' Save the time.
  9. 20   defint a-z                ' Integer to gain some speed.
  10. 30   n$ = chr$(0)
  11. 40   z = asc("0")
  12. 50   t = asc("~")-z
  13. 60   def fnuchr%(a$)=asc(a$)-z
  14. 70   open "MSKERMIT.BOO" for input as #1
  15.  
  16. 100  input#1,f$                ' Is this the right file?
  17. 110  if len(f$) > 20 then goto 900
  18. 120  open f$ for output as #2
  19. 130  print "Outputting to "+f$
  20.  
  21. 200  if eof(1) then goto 800        ' Exit nicely on end of file.
  22. 210  input#1,x$                ' Get a line.
  23. 220  y$ = ""                ' Clear the output buffer.
  24. 230  goto 400
  25.  
  26. 300  print#2,y$;            ' Print output buffer to file.
  27. 310  goto 200                ' Get another line.
  28.  
  29. 400  if len(x$) = 0 goto 300        ' Is the input buffer empty?
  30. 410  a = fnuchr%(x$)
  31. 420  if a = t then goto 700        ' Null repeat character?
  32. 430  q$=mid$(x$,2,3)            ' Get the quadruplet to decode.
  33. 440  x$=mid$(x$,5)
  34. 450  b = fnuchr%(q$)
  35. 460  q$ = mid$(q$,2)
  36. 470  c = fnuchr%(q$)
  37. 480  q$ = mid$(q$,2)
  38. 490  d = fnuchr%(q$)
  39.  
  40. 500  y$ = y$ + chr$(((a * 4) + (b \ 16)) and 255) ' Decode the quad.
  41. 510  y$ = y$ + chr$(((b * 16) + (c \ 4)) and 255)
  42. 520  y$ = y$ + chr$(((c * 64) + d) and 255)
  43. 530  goto 400                ' Get another quad.
  44.  
  45. 700  x$ = mid$(x$,2)            ' Expand the nulls.
  46. 710  r = fnuchr%(x$)            ' Get the number of nulls.
  47. 715 print " Null: ",r
  48. 720  x$ = mid$(x$,2)
  49. 730   for i=1 to r            ' Loop, adding nulls to string.
  50. 740   y$ = y$ + n$
  51. 750   next
  52. 760  print#2,y$;            ' Output the nulls to the file.
  53. 770  y$ = ""                ' Clear the output buffer.
  54. 780  goto 400
  55.  
  56. 800  print "Processing complete, elapsed time: "+t$+" to "+time$
  57. 810  print "Output in "+f$
  58. 820  close #1,#2
  59. 830  goto 9999
  60.  
  61. 900  print "?The version of the MSKERMIT.BOO file is incorrect"
  62. 910  goto 820
  63.  
  64. 9999 end
  65.