ATOB.DOC 941013 ATOB.DOC 4101 This file ATOB-22.C 5237 'C language version BTOA-22.C 6259 'C language version ATOB.ASM 7782 Assembly language version BTOA.ASM 7395 Assembly language version ATOB 1272 Assembled decoder BTOA 1180 Assembled encoder AVAIL 372 Test file AVAIL.AB 520 Test file encoded AVAIL.DOC 3801 Example BINTEST.AB 1704 Example copyied off packet radio These programs, BTOA and ATOB, are encode/decode programs for sending binary files over Amateur Radio Packet. They are also useful for transmitting/storing files when only 7 bit ASCII characters are allowed. Typical overhead is 20%. The BTOA encoded file may be edited with instructions, comments, or whatever, added to both beginning and end of the actual file and ATOB will ignore all but the actual encoded file. These are AMIGA Assembly language versions, compatible with MSDOS (IBM) versions. Files transferred using these programs will survive 7 bit ASCII Amateur radio transmissions and can be forwarded through the BBS network. There are no end of line spaces or funny characters, so an encoded file may be sent in separate smaller parts and rebuilt at the receiving end using a simple text editor. PERMISSION GRANTED FOR ALL NON-COMMERCIAL USES OF THIS SOFTWARE. BTOA - The encoder ------------------ A self prompting encoder program. It asks for the file to be encoded, a name which will be put in the file header, and the name of the temporary storage file. It first makes a header in the form; xbtoa Begin Filename which is followed by the encoded data. The data ranges from ASCII '!' to 'u' with 'z' representing a 32 bit binary zero when on a longword boundary. The character 'x' marks end of data. Note that 'space' is NOT used because some programs delete trailing spaces. The program essentially uses a modulo 85 divide on incoming 32 bit longwords to produce 5 ASCII characters for each 4 byte binary longword. Line length is held to 76 characters, with LF separating lines. The trailer is in the form; xbtoa End N CHARS(Decimal) CHARS(Hex) E CEOR S CSUM R CROT where N CHARS is character count of original file in both decimal and hex, E CEOR is an exclusive-or checksum, S CSUM ia a simple addition checksum, and R CROT is a shift-rotate checksum. ATOB - The decoder ------------------ A self prompting decoder program. It asks for the file to be decoded and a filename for the decoded file if one was not found in the header of the encoded file. If a filename is found, it prompts to continue - type 'N' if you want to change the name of the file to be written, otherwise type C/R. This program makes many checks of the incoming file. After it opens the read file, it searches for a correct BTOA header line and parses the included filename from the header. Then it prompts and gives the user a chance to rename the file to be written. Data is then decoded, making checks for legal ASCII characters between '!' and 'u', or 'z' or 'x', ignoring LF's. Zero value longwords must occur on a longword boundary. Errors cause the program to abort after telling the user what was wrong. The trailer also has numerous checks. An error here causes the original trailer to be printed, followed by the calculated header, for visual comparison. Note that characters are not counted during decode, and the only check on character count is to compare the decimal and hex values in the trailer. This program was written to produce the same results as the original 'C language version, which means that zero bytes are added by BTOA to fill a longword. ATOB, as a result retains the zero bytes. This should not cause problems on the Amiga, except for text files which may have an odd number of bytes. In this case, using ED on the decoded text changes the remainder zero bytes to LF's and can be edited out. The Amiga ALINK generates programs that are always longword aligned, so no problems here. Assembly Language source files are included. Randy Lilly N3ET @ N3ET.PA (Ham Radio Packet) 752 S. Carldon St. Allentown, PA. 18103