home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / c-kermit / ckboo.txt < prev    next >
Text File  |  2020-01-01  |  3KB  |  71 lines

  1. BOO FILE FORMAT, ENCODING AND DECODING
  2.  
  3. Many Kermit programs are often distributed using a special encoding called
  4. "boo" (short for "bootstrap") format, developed especially for distribution of
  5. Kermit binaries over networks, e-mail, and communication lines.
  6.  
  7. A common practice is to encode .EXE and other binary files into printable
  8. characters, such as hexadecimal digits, for transportability.  A simple "hex"
  9. encoding results in two characters per 8-bit binary byte, plus CRLFs added
  10. every 80 (or less) hex characters to allow the file to pass through
  11. card-oriented networks like BITNET.  A hex file is therefore more than twice
  12. as large as the original binary file.
  13.  
  14. A .BOO file is a more compact, but somewhat more complicated, encoding.  Every
  15. three binary bytes (24 bits) are split up into four 6-bit bytes with 48 (ASCII
  16. character "0") added to each, resulting in four ASCII characters ranging from
  17. "0" (ASCII 48) to "o" (ASCII 111), with CRLFs added at or near "column 76".
  18. The resulting file size would therefore be about 4/3 the .EXE file size.  This
  19. is still quite large, so .BOO files also compress consecutive null (zero)
  20. bytes.  Up to 78 consecutive nulls are compressed into two characters.  Tilde
  21. ("~") is the null-compression lead-in, and the following character indicates
  22. how many nulls are represented (subtract 48 from this character's ASCII
  23. value).  For instance "~A" means 17 consecutive nulls; "~~" means 78 of them.
  24. Repeated nulls are very common in binary executable files.
  25.  
  26. 4-for-3 encoding combined with null compression reduces the size of the
  27. encoded file to approximately the same size as the original .EXE file, and
  28. sometimes even smaller.  The first line of a .BOO file is the name (in plain
  29. text) of the original file.  Here's what the first few lines of a typical .BOO
  30. file look like:
  31.  
  32.   CKERMIT.EXE
  33.   CEYP0Id05@0P~3oomo2Y01FWeP8@007P000040HB4001`W~28bL005\W~2JBP00722V0ZHPYP:
  34.   \8:H2]R2V0[`PYP:68>H2S23V0YHPiP:Xg800;Qd~2UWD006Yg~2Ogl009]o~2L8000;20~~~~
  35.   ~~~~~~~:R2H008TV?P761T410<H6@P40j4l6RRH0083l17@PP?`1M@?YSP20o0Ee0nUD0h3l
  36.   1WD3jO@3]0VjW03=8L?X4`N0o01h1\H6~20l>0i7n0o1]e7[@2\PO=8LH60@00Raj>04^97Xh0
  37.  
  38. Executable C-Kermit programs are distributed in BOO format for the Commodore
  39. Amiga, OS/2, and possibly others.  BOO format is also used for MS-DOS Kermit,
  40. Microsoft Windows Kermit, and other Kermit versions that are not part of
  41. C-Kermit.
  42.  
  43. The program for converting a binary executable (or any other) file into
  44. BOO format is:
  45.  
  46.   CKBMKB.C
  47.  
  48. Compile this program using your C compiler and then run it, giving the name
  49. of the input (binary) and output (boo) files as a command-line arguments, for
  50. example:
  51.  
  52.   ckbmkb ckermit.exe ckermit.boo
  53.  
  54. The program for converting a BOO file back into its original form (such as
  55. binary executable) is:
  56.  
  57.   CKBUNB.C
  58.  
  59. Compile this program using your C compiler and then run it, giving the name
  60. of the input (boo) file as a command-line argument, for example:
  61.  
  62.   ckbunb ckermit.boo
  63.  
  64. This will re-create the file with its original name (as stored in the first
  65. line of the BOO file).
  66.  
  67. These two programs are identical to the MSBMKB and MSBPCT programs that are
  68. distributed with MS-DOS Kermit.  BOO-file makers and decoders are also
  69. available in other languages (Fortran, Pascal, Assembler, etc) in the MS-DOS
  70. Kermit file collection under the MSB prefix.
  71.