info-mac@uw-beaver (info-mac) (10/26/84)
From: Ed Pattermann <PATTERMANN@SUMEX-AIM.ARPA> To respond to many requests for help and questions on how to download .RSRC and .DL files (and just what are they?), Bill Croft and I have written a document describing such. The document follows, and is also stored under {SUMEX}<INFO-MAC>DOWNLOAD.DOC. I hope those who have questions find it useful. -- Ed ----------------- THIS FILE WILL EXPLAIN o A Bit About Macintosh Files o The Difference Between .Rsrc And .Dl Files o How To Download .Rsrc And .Dl Files To A Macintosh .... HOPE YOU FIND IT USEFUL MACINTOSH FILES HAVE TWO 'FORKS' Each file on your Mac consists of two parts: a data 'fork' and a resource fork. Each fork is actually a complete, individual file. In practice it turns out that most Mac files have information in only one of the forks, the other fork is typically empty. (Sounds kind of silly, huh)? Thus if a Mac file is called a 'resource file', it generally has a resource fork but no data fork. Vice versa for a 'data file'. Examples of resource files are executable programs and fonts. Data files would be ascii text files, pictures, etc. Resource files have an additional characteristic: they have an internal structure consisting of an index and one or more 'resource's, each with an 'id'. For example, a font file has a separate id for each font type and size; an executable program has an id for each overlay segment. '*.RSRC' FILES A Macintosh executable binary file (as generated by the Apple workshop or by SUMacC or other compilers) is a resource file. On the 'development' host (Lisa, UNIX, [TOPS20 too]) the file will have the filename suffix '.RSRC'. This is to distinguish which Mac fork the file belongs in. These files are not printable, they contain only 8-bit binary data. Sometimes you may see the file suffix '.DATA', this would represent the contents of the data fork (data file). '*.DL' FILES 8-bit binary data can't go thru the mail. 8-bit data also isn't very user friendly on such systems as TOPS20; TOPS20 packs character data by default in 7-bit bytes, which looses information in this case. [SUMEX is a TOPS20 system]. For this reason, a simple format was invented, called 'fromhex' or '.dl' (download) format. Each 8-bit binary byte in the .rsrc file is represented as two printable ascii characters (hex nibbles) in the .dl file. At the end of the .dl file is a checksum to guard against errors. To translate between 8-bit binary and hex format there are two programs: 'fromhex' reads a hex file and writes a binary file; 'tohex' reads a binary file and writes a hex file. These programs are FTPable from the [SUMEX]<info-mac> directory: fromhexu.c UNIX C version (or Mac C with stdio) fromhex.c Mac C version (SUMacC) fromhex.p Mac compiled Pascal (Apple workshop compiler) fromhex.rsrc executable version of fromhex.p fromhex.dl .dl version of fromhex.rsrc tohex.c UNIX C version The fromhex programs assume that any mail headers have been removed from the file. The UNIX version is a 'filter' [fromhex <x.dl >x.rsrc]; it reports whether the checksum was good or bad. The Mac version reads a data file called 'C' and writes an executable resource file called 'C prog'; it beeps if there was a checksum error. FILES ARCHIVED ON SUMEX <INFO-MAC> Since SUMEX is a TOPS20 (36-bit word) system, it has different file formats for 7-bit ascii (printable) versus 8-bit (binary) files. .RSRC files (and .DATA files) are stored in 8-bit mode. .DL files (and most other files) are stored in the default 7-bit mode. This is important to know if you are FTPing a file from SUMEX to a UNIX or most other systems. When retrieving a file from SUMEX to a UNIX, check the suffix. If it is .RSRC or .DATA, you must use the FTP command 'tenex' or 'type l 8' before the transfer to get all 8 bits transfered correctly. If the file has any other suffix, it is an ordinary text file and can be FTPed with the default 'ascii' mode. Whether a program is stored on SUMEX in .RSRC or .DL mode seems to be a random function. Currently if you need the other format, you should FTP it to your local site (usually a UNIX) and convert it there using the fromhex/tohex programs listed above. UNIX DOWNLOADING First get the file into .rsrc form. This may require running fromhex. Assume the resulting file is called handson.rsrc. Run MacTerminal (version 1.1 is recommended). Ensure that the MacTerminal configuration contains: 8 bits per char, parity none, handshake none, xmodem transfer method, remote system macterminal, no delays. The hardwire or modem connection to your UNIX must be capable of passing all 8 bits transparently. If a terminal switcher, network or 'smart modem' intercepts something, your transfer could freeze midway. Log into your UNIX and type 'macput -r handson'. This should start the transfer automatically and show you a 'thermometer' indicating the percentage of the transfer complete. After the transfer is complete you can quit and double-click your new program to start it. Macput / macget were written by Dave Johnson of Brown University and are available for FTP from [SUMEX]<info-mac> {macget,macput}.{c,1}. DOWNLOADING FROM OTHER HOSTS (E.G. TOPS20) WITHOUT MACPUT Macput understands the same XMODEM protocol that MacTerminal uses. Macput also knows a special Mac-only protocol used between two consenting MacTerminals. The Mac-only protocol allows an entire Mac file, consisting of data and resource forks, to be transfered. There are other programs which speak XMODEM, for example the MODEM program on TOPS20. However MODEM does not currently have a switch to turn on the Mac-specific protocol. Consequently, MODEM can only transfer a data fork to or from the Mac. There is no way, either on MacTerminal or MODEM, to specify a resource fork transfer. [We have heard rumors that BILLW@SRI is working on fixing MODEM.] There is another possibility: KERMIT. If you have kermit running on your host, and a Mac disk containing the kermit program, you should be able to transfer resource and data files. Since the Mac kermit is just stabilizing and is not yet in wide availability, we havent tried this yet. Perhaps your hardest task will be to get the binary kermit program onto your Mac disk. Sounds like a bootstrap problem... For folks without macput, kermit, or anything, read on about .DL downloading. DOWNLOADING .DL FILES You need a Mac disk with the 'fromhex' program discussed above. This was originally sent out with the early SUMacC distribution (before macput). If you don't have it you might: (1) find a UNIX friend who can macput it to your disk. (2) download (via lisaterminal 'receive to file') fromhex.p to your Lisa and compile it. (3) download (via MacTerminal 'save lines off top') fromhex.c to your Mac and use a C compiler to compile it. (4) translate fromhex to your favorite language; mikes@cit-vax has a Forth version, does someone have a Basic version? After you have fromhex and MacTerminal on your disk, login to your host and ensure that the .dl file has no garbage or headers on the front of it. Then using MODEM (on TOPS20) or 'save lines off top', transfer the printable .dl file to your Mac disk as a file named 'C'. When the transfer is complete, quit MacTerminal and run fromhex. This will read 'C' and produce 'C prog'. Fromhex will beep if there was a checksum error. After you have the finder again, rename 'C prog' to whatever and double click it; your program should start. Bill Croft and Ed Pattermann SUMEX Computer Project ---------------------------- -------
info-mac@uw-beaver.UUCP (11/02/84)
From: Bill Croft <croft@safe> Date: Mon, 29 Oct 84 12:45:10 PST From: Matthew J Weinstein <matt@UCLA-LOCUS.ARPA> Subject: Re: Help on downloading MACintosh files Why weren't DL files defined to use 6 bits per character? This would have yielded only 25% waste, instead of 50%. There are 64 printable characters in ASCII, I think. Also, the most brain-damaged machines I can think of, short of a 4004, have at least a 6-bit character set. Just curious. - Matt ---- The fromhex/tohex stuff was only intended as a primitive way to download programs in the early (June) version of our SUMacC cross development system. It was made to be as simple as possible. We never intended it as a universal mail-media for Mac programs. It just began to be used that way. Actually, as I understand it, the BINHEX format (used on Compuserve MAUG) is somewhat more general, in that it allows the data, resource, and 'finder info' (4 bytes each of type/owner) portions of a file to be represented as one hex collection of stuff. Again, though, it's hex instead of sixbit. Also, it only exists right now as a 500 line MS-Basic program. Fromhex.c is only 30 lines long. Frankly I store all this stuff in 8-bit '.rsrc' files on my UNIX. You could use UNIX 'uucp' 'uuencode' (a six bit format) if you want to mail these files most efficiently.