home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / compsrcs / misc / volume12 / unboo.bas < prev   
Encoding:
Internet Message Format  |  1991-08-27  |  3.2 KB

  1. From decwrl!ucbvax!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!allbery Wed Apr 25 08:12:16 PDT 1990
  2. Article 1493 of comp.sources.misc:
  3. Path: decwrl!ucbvax!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!allbery
  4. From: nghiem@ut-emx.UUCP
  5. Newsgroups: comp.sources.misc
  6. Subject: v12i013: unboo.bas - decode Kermit boo format
  7. Message-ID: <85950@uunet.UU.NET>
  8. Date: 24 Apr 90 01:21:21 GMT
  9. Sender: allbery@uunet.UU.NET
  10. Organization: UTexas Computation Center, Austin, Texas
  11. Lines: 84
  12. Approved: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  13.  
  14. Posting-number: Volume 12, Issue 13
  15. Submitted-by: nghiem@ut-emx.UUCP
  16. Archive-name: unboo.bas
  17.  
  18. [Forwarded from comp.binaries.ibm.pc; I'm not certain it belongs here, but then
  19. where else can it go?  ++bsa]
  20.  
  21. #! /bin/sh
  22. # This file was wrapped with "dummyshar".  "sh" this file to extract.
  23. # Contents:  UNBOO.BAS
  24. echo extracting 'UNBOO.BAS'
  25. if test -f 'UNBOO.BAS' -a -z "$1"; then echo Not overwriting 'UNBOO.BAS'; else
  26. sed 's/^X//' << \EOF > 'UNBOO.BAS'
  27. X1    'Use this BASIC program on the PC if you have the printable file 
  28. X2    'MSVIBM.BOO already on the PC to convert it to an executable
  29. X3    'file.  This program takes about 30 minutes to run on a PC with
  30. X4    'floppy disks.
  31. X5    ' Bill Catchings, June 1984
  32. X6    ' Columbia University Center for Computing Activities, New York
  33. X
  34. X10   t$ = time$                ' Save the time.
  35. X20   defint a-z                ' Integer to gain some speed.
  36. X25   b$ = "MSVIBM.BOO"                  ' Name of input .BOO file.
  37. X30   n$ = chr$(0)
  38. X40   z = asc("0")
  39. X50   t = asc("~")-z
  40. X60   def fnuchr%(a$)=asc(a$)-z
  41. X70   open b$ for input as #1
  42. X
  43. X100  input#1,f$                ' Is this the right file?
  44. X110  if len(f$) > 20 then goto 900
  45. X120  open f$ for output as #2
  46. X130  print "Outputting to "+f$
  47. X
  48. X200  if eof(1) then goto 800        ' Exit nicely on end of file.
  49. X210  input#1,x$                ' Get a line.
  50. X220  y$ = ""                ' Clear the output buffer.
  51. X230  goto 400
  52. X
  53. X300  print#2,y$;            ' Print output buffer to file.
  54. X310  goto 200                ' Get another line.
  55. X
  56. X400  if len(x$) < 2 goto 300        ' Is the input buffer empty?
  57. X410  a = fnuchr%(x$)
  58. X420  if a = t then goto 700        ' Null repeat character?
  59. X430  if len(x$) < 3 goto 300        ' Is the input buffer empty?
  60. X440  q$=mid$(x$,2,3)            ' Get the quadruplet to decode.
  61. X450  x$=mid$(x$,5)
  62. X460  b = fnuchr%(q$)
  63. X470  q$ = mid$(q$,2)
  64. X480  c = fnuchr%(q$)
  65. X490  q$ = mid$(q$,2)
  66. X500  d = fnuchr%(q$)
  67. X
  68. X600  y$ = y$ + chr$(((a * 4) + (b \ 16)) and 255) ' Decode the quad.
  69. X610  y$ = y$ + chr$(((b * 16) + (c \ 4)) and 255)
  70. X620  y$ = y$ + chr$(((c * 64) + d) and 255)
  71. X630  goto 400                ' Get another quad.
  72. X
  73. X700  x$ = mid$(x$,2)            ' Expand the nulls.
  74. X710  r = fnuchr%(x$)            ' Get the number of nulls.
  75. X715 print " Null: ",r
  76. X720  x$ = mid$(x$,2)
  77. X730   for i=1 to r            ' Loop, adding nulls to string.
  78. X740   y$ = y$ + n$
  79. X750   next
  80. X760  print#2,y$;            ' Output the nulls to the file.
  81. X770  y$ = ""                ' Clear the output buffer.
  82. X780  goto 400
  83. X
  84. X800  print "Processing complete, elapsed time: "+t$+" to "+time$
  85. X810  print "Output in "+f$
  86. X820  close #1,#2
  87. X830  goto 9999
  88. X
  89. X900  print b$ " does not seem to be in .BOO format."
  90. X910  goto 820
  91. X
  92. X9999 end
  93. EOF
  94. chars=`wc -c < 'UNBOO.BAS'`
  95. if test $chars !=     2083; then echo 'UNBOO.BAS' is $chars characters, should be     2083 characters!; fi
  96. fi
  97. exit 0
  98.  
  99.  
  100.