[comp.sys.atari.8bit] Information on BINHEX???

jhs@MITRE-BEDFORD.ARPA (01/08/87)

Does anybody have a precise definition of the output format of BINHEX?
I would like to convert my uudecode routine to decode BINHEX files, but I
am not sure of some of the details.  Specifically...

In the one example I have (TURBO BASIC), the file begins with the line
".START.<RETURN>".  Then there are many lines of precisely 36 Hex digits,
followed by a <RETURN> after each such group of 36.  Finally there is a line
with only 28 Hex digits, followed by a <RETURN>.  Well, not really finally,
because there is another line with ".STOP.2397155<RETURN>" followed by a
line with four special graphics characters and a <RETURN>.  It looks as if
the special character may be Hex $01, repeated 4 times.

I suspect that the "2397155" may actually be the decimal value of the sum of
the bytes in the file.  This would be about right if the data values are
biased toward being between 0 and 127.  The file contains about 36K bytes, by
the way.

I am not sure of several things, and would like answers to the following
questions from someone who is sure of the answers:

1.  Is there some internal coding of the length of each line, as in uuencode?
If not, how is the decoding program supposed to know when it has encountered
the last line?  Must it simply look for the .STOP. line?

2.  Is the data following .STOP. indeed a checksum?  If so, is it just what I
said I suspected, the decimal sum of the bytes?  Or what?

3.  What is the purpose of the four $01 characters at the end?  A marker of
some kind or just some junk that got included somewhere along the way?

Any help that is forthcoming will be appreciated.  If anybody wants the
HEXBIN subroutine when it is finished, or the main program that will use it
to decode files, send me a note to that effect and I will post the program.
Please, however, allow several weeks for delivery, based on my recent
performance in getting programs "out the door".

-John Sangster
jhs@mitre-bedford.arpa