[net.micro.atari] --- Posting binaries ---BINHEX/HEXBIN

Fleysher.wbst@XEROX.ARPA (Dan Fleysher) (11/20/85)

I wrote BINHEX and HEXBIN.  They are BASIC programs written for the
400/800 and XL machines, so they are excruciatingly slow.  You really
have to want to send a binary file to someone if you are going to use
them!   I never took the time to speed things up with machine language
assist - anyone who wants to do so is welcome to it.  (Please share your
improvements with the rest of us, however).

The attachments below contain background on how BINHEX and HEXBIN work.
The two messages which follow this one contain the Atari-BASIC source
code for the two utilities respectively.

The most successful use of BINHEX and HEXBIN was for distributing the
VT100 80 column terminal emulator last year.  Little more has been done
since then.

My apologies to everyone who has seen this stuff before - just toss it
out as you see fit.

	Dan

----------------------------------------------------------------
GVInfo: Fleysher.WBST, from 125#2, at  1-Oct-84 14:30:25 EDT 
Date:  1 Oct 84 14:30:24 EDT (Monday)
Subject: HELP for the Tired Typer
In-reply-to: <KPETERSEN.12051730238.BABYL@SIMTEL20>
To: AtariUsers^.wbst
cc: info-micro@BRL.ARPA
From: Dan Fleysher <Fleysher.wbst>
Reply-to: Fleysher.wbst

Exchanging home-brew BASIC programs within messages over the net
requires a modem and a good upload terminal emulator program (such as
ATERM, distributed on the net in Oct. '82).  Even with this set up,
plenty of information can get lost in the transmission - e.g.,
inverse-video and graphics characters.  Sometimes these are crucial when
the BASIC program contains machine language assist in the form of text
strings (rather than data statements).

I have written a pair of companion BASIC programs which enable the
exchange of arbitrary files over the net with no loss of data.  This is
accomplished by converting the file to be sent into a text file
containing hexadecimal characters, two for each byte of the original
file.  One of the programs does the conversion to hexadecimal format,
and the other converts the received hex file back into its Atari-useable
form.

Before I publish these two programs, I would like to invite
agreement/disagreement on a standard format for exchange.  The format I
propose is:

--------------------
message header, explanatory
text, and general comments
.START.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxx
.STOP.nnnnn
optional extra text
--------------------

The translator for the received program ignores all text until it
encounters the record ".START."  Subsequent records contain hexadecimal
characters (x's, above) in convenient (although unspecified) record
lengths.  The receiving program translates the hex characters into bytes
until it encounters the .STOP. record.  The number that follows ".STOP."
is a decimal checksum, computed by adding up all the preceding bytes
encoded as hex characters. (The checksum limit of 10 digits corresponds
to a file length of more than 78 megabytes of average data)

My programs use record lengths of 36 hex characters so that they fit
easily on the 40 character screen.  Although the programs are written in
Atari BASIC, there is no reason they could not be re-implemented as
machine language programs (for speed).  These could also be distributed
to the net using this facility.

Needless to say, this facility is proposed for exchanging PERSONAL or
public-domain software only.

Opinions anyone?


	Dan

-----------------------------------

Date: 13 Nov 84 09:21:48 EST (Tuesday)
Subject: Exchanging Binary Files over the net
To: AtariUsers^.wbst
cc: Fleysher.wbst
From: Dan Fleysher <Fleysher.wbst>
Reply-to: Fleysher.wbst

Last month I proposed a standard for exchanging binary files over the
net in text messages by first converting them to hexadecimal.  That
message is attached.

I received an excellent suggestion from  ken@ROCHESTER to add checksums
to the end of each line, rather than just the end of the document, in
order to enable easier recovery.  Unfortunately I haven't had the time
to incorporate this change, but my experience has been that if I receive
a message at all, I get it without errors 99.999% of the time.  I also
received suggestions to look at KERMIT protocol, but I already have an
reliable underlying transmission protocol - the message system.

Consequently, I am distributing two BASIC programs - BINHEX & HEXBIN -
that can be downloaded and used to encode and decode binary files
to/from hex (text) format.  Someday, I'll convert them to machine
language and redistribute them (I apologize for the performance of the
BASIC versions).

In the meanwhile, if anybody uses them and finds bugs or has
suggestions, I would appreciate hearing about your experiences.

	Dan