This is a piece that I have been working on for
some time, and will probably never "finish," so I've decided to put it out to
the public. If you have any questions about this, or would like any additional
programs or software mentioned in the text, please email me at danm@hevanet.com

Archive, store, transfer, and copy HP-IL files to and from your modern DOS
computer, without the HP-IL/PC Interface Card (HP 82973A). Reach into the
past; access and use the wealth of data and expertise that now quietly resides
in the "Swap Disk" internet ftp archive. Thousands of files and programs exist
for the HP-41, 71, and 75 and are easily available for (almost) immediate use.

The purpose of this paper is to describe how to transfer HP calculator files
between DOS and HP-IL, without using the specialized PC/HP-IL interface board
(HP 82973A). Background information will be presented to explain the context of
this topic and show its relevance. Applications of these techniques will also be
shown to illustrate their usefulness.

Scope:

This paper refers specifically to files generated or used by the HP-41,
HP-71, and HP-75 series of calculators. The same general procedures apply to
other LIF files, generated by other HP equipment, but any subtle nuances of
these files are not explored or explained.

Background:

The HP-41 calculator was introduced in 1979, long before desktop personal
computers became ubiquitous. As an alpha-numeric, programmable, expandable
calculator, it was a very powerful computational tool and became immensely
popular. Some of its features that are important to this topic include:

Could do "long" programs

Had Input/Output capabilities

Expandable, to accommodate future, as-yet-undeveloped hardware

A devoted user community developed around this calculator, in many ways an
extension of the devoted user community that had developed around earlier HP
calculators. Specialized applications and programs were created to exploit the
calculator's capabilities. The early means of distribution of these
user-developed programs included the following:

Source-code printouts

Magnetic Cards

Bar Codes

Customized ROM

Each of these distribution methods has its advantages and disadvantages.

Advantages

Disadvantages

Source Code Listings:

Cheap

Easy

No additional hardware needed except perhaps a printer for one person
to create the listing

Each user would have to re-key in the entire
program. Lengthy and prone to mistakes.

Magnetic Card Storage

No need to re-key in the program – quicker and
mistake-free

Requires additional hardware (Card
Reader/Writer) to create or use the cards.

As time went on, new hardware based on the Hewlett Packard Interface Loop
(HP-IL) was introduced that provided additional options for storage and transfer
of programs. This included a cassette tape drive at first, followed later by a
floppy disk drive, as well as other devices.

The advantages and disadvantages of the tape and disk drives are summarized
in this table:

The user communities would hold regular meetings and conferences where ideas
and progress could be discussed, and programs exchanged. Even though additional
hardware was expensive, there would usually be somebody amongst those gathered
who could bring hardware to share, and programs could be disseminated readily at
these meetings.

Additional calculators/computers were introduced that could use the HP-IL
hardware: the HP-75C/D, and the HP-71B. These machines had strong followings as
well, and masses of specialized programs were created to support these
platforms. The files created for these machines became larger and more complex.
They included large BASIC programs, and special Logical Extension Files (LEX)
that greatly expanded the capabilities of the HP-71B. The LEX files took
additional hardware (ROMs) to create, but once compiled could be distributed and
used without any extra hardware necessary.

During these times, a user "Swap Tape" program was developed. New programs
would be collected and copied onto tape, then the tape could be copied and
distributed to users. At user conferences, each person would supply their own
tape (and contribute programs), all the programs would be copied onto a master
tape which would then be re-copied back onto the users’ supplied tape to be
taken home.

The Swap Tape program evolved into a "Swap Disk" program, where the same
thing would happen using disks for media instead of tape. A single disk would
contain programs for the HP-41, HP-75, and HP-71.

HP produced test equipment that used the same disk formats as the HP-IL
drive. This test equipment sold very ell, but HP-IL disk/mass storage devices
never becam big, cheap, or widespread.

Later on, HP developed a card for the PC that would provide access from the
PC to HP-IL devices. This card is called the HP 82973A. Having this card should
allow the owner to easily transfer HP-IL files to DOS and back, making the
procedures in this paper unnecessary. This card allows the user to do other
interesting things, including using the PC keyboard as a keyboard for the
HP-71B. (It should be pointed out that HP-71B BASIC files can be composed as
text files on the PC, then transferred to the HP-71B using the techniques from
this paper, and compiled into BASIC there.) While these 82973A cards are
occasionally available on ebay, they were never widely popular, remain somewhat
rare, are still relatively expensive, and come with a big warning. The warning
is: these cards were designed for old-era PCs (16 MHz speed), and are
reported to be unstable at best when installed in a modern PC.

Eventually with the progress in computing and handheld device technology, and
for various other reasons, the user community for these devices has changed.
Published journals and organized clubs no longer exist. Even the venerable HP
Journal has ceased publication and moved "on-line." The years of dedicated
enthusiasm by a large user community for the older machines have left behind a
legacy of published documentation and archived specialized programs.

Publications and journals of the era from Hewlett-Packard and the user
community have been preserved and are available from Jake Schwartz, at http://www.jakeschwartz.com/. His set of
CD-ROMs contains over 2,000 pages of tidbits, programs, history, insights,
drama, and intrigue. Believe it or not, this can be fascinating if not essential
reading for those interested in calculators, calculator history, or just trying
to use and understand their good old calculator(s).

The "Swap Disk" program, although "dead," has been archived and lives on-line
at ftp://ftp.math.jyu.fi/pub/hpil/
and subdirectories. Thousands of files for the HP-41, 71, and 75 are stored
there to be downloaded and used.

Today’s Status:

The HP-75C/D, apparently never very popular, is even less so now. The HP-71B
has some life today as an excellent handheld implementation of BASIC and a
unique and powerful calculator. The HP-41 series of calculators remains popular
in the engineering and survey worlds as an excellent easy-to-use programmable
RPN calculator. Continuing the tradition of independent user groups, there is
strong widespread user support and dedication to HP’s modern calculators (HP-48
series). Hewlett Packard released a new calculator (HP-49G: in stores
mid-August, 1999) which initially received mixed reviews from the user
community.

Today’s computing world is filled with cheap and plentiful computers with
capacious hard disk storage. Email and networks are pervasive and available.
Calculators are no longer the only option for the center of the personal
computing universe. The old calculators, however, still have just as much
computing power as they ever did, and what’s more, most of the extra hardware
for them that was way too expensive at the time is still available now but is
much more affordable.

So for a moderate investment, the hobbyist of today has the option of owning
top-of-the-line equipment from an earlier era, equipment that may satisfy or
exceed all of their needs. A person may have, for example, an HP-41 calculator
that they want to "trick" out, or use to perform some type of special function.
This person may be interested to know that perhaps what they want to do has
already been done and resides peacefully in an archived file easily accessible
by ftp. This paper will help them find out if that is true, and show them how to
get and use that file.

How is this useful?

There are many people who still use and enjoy their old calculators. If this
seems unbelievable, a check of ebay prices for HP calculators and HP-IL
equipment will show that there is some value left in these devices. Perhaps also
of interest are the ebay prices of TI calculators. It should be found that the
TI calculators command a much smaller price than HP calculators do. Reasons for
this are open to debate, but the point that people collect (and presumably, some
are collected to be used) and pay good money for HP calculators should be well
taken.

There are several advantages to the HP calculator user of being able to
transfer files between the HP-IL file system and the PC/DOS environment. Some of
them are listed below:

Mass Storage of HP-IL files. Important files should be stored outside the
calculator somewhere, as calculator memory can be lost or inadvertently
cleared. The HP-IL storage devices are, small, old and slow. DOS storage
devices are ubiquitous, faster, and big. If HP-IL files could be easily kept
on DOS instead of old and slow HP-IL, they could be stored, backed up, and
handled easily in bulk on a reliable hard drive

Distribution of files. DOS files can be emailed around or stored on-line
for easy retrieval. This avoids the old problems of messing with cards or bar
code, or sending disks or tapes via surface mail.

Access the Swap Disk ftp archive. Thousands of files of legacy software
files are out there waiting to be used again. You can get to them with the
PC/HP-IL interface card if you have it, or using methods like this.

Save some time. Imagine typing that entire 16K Startrek Basic program into
your 71B, then debugging your typos, only to find out that the whole thing
SUCKS. With these procedures, you can take a minute or two to pop it over to
your machine and play around with it. Then, when considering the amount of
time you have invested in it compared to the amount of time it took
somebody to write it, it’s not that bad, and actually kind of fun.

Technical Background
Information:

Now that we see how useful it can be, we need to have some background
information so the rest of it makes sense.

LIF storage is fairly simple to understand. The first implementations of this
system were on tape, so it makes even more sense. At the start of the tape –or
disk– space is set aside on the media for the directory: to record how many
files there are, what are their names, where they are located, how long they
are, whether they’ve been deleted or not, etc. After the directory space comes
the files stored one right after the other, like on a tape. One thing about LIF,
it’s entirely one-dimensional: there aren’t any of those confusing (or useful)
hierarchical directory structures. There’s just the files, one right after the
other. Of course, LIF must include other details like the volume label, the
number of bytes per record, number of records per file, trying to write a new
file over the space vacated by a deleted file, etc, etc, but these are not
important to this paper. So on the disk (or tape), there’s the directory and
there’s the files.

The Files.

The files as stored are just themselves – ASCII, binary, whatever. If you
were to examine the non-directory part of the tape or disk byte by byte, you’d
see them all there. And, while you could probably tell where one file stops and
another begins, you’d have to be pretty good to tell what each is supposed to
do, and you’d never be able to tell what any of them are called (the
filename is stored in the directory, NOT with the file). So we all need the
Directory.

The LIF Drive Directory.

Here’s what part of the directory of one of my disks looks like.

Figure 1: LIF Directory HEX Dump

This (Figure 1) is a hex dump of the directory. Hey – we can see what looks
like file names in this mess. And, it looks like there’s a file name on every
other line. Each file stored on the tape or disk has a directory entry, which
takes up 32 bytes of space in the directory area. This is how the size of the
directory affects the number of files that can be stored on a disk – if there’s
not any more room for a directory entry, then even if space is available for
storage, you can’t put any more files on your disk.

The Individual LIF Directory Entry.

Here’s what the directory entry for one file looks like:

Figure 2: Individual LIF Directory Entry

So here’s what the directory entry for one file contains:

What we care about right now:

It has the File Name (bytes 01-09)

It has the File Type (bytes (0A-0B)

It has the essential File Implementation Bytes (1C-1F)

These implementation bytes (1C-1F Hex, 29-32 Dec) are very important.
They represent various things about the file (relating to size, file type,
number of bytes in file, etc.), but what exactly they represent is not
important. What is important is that the file can not be used if these bytes
are in any way different from what they should be. Programs will not run,
data will not be read: the file will be useless. Even though it may have been
copied to disk correctly and exist there byte-for-byte identical to its
original, if these File Implementation Bytes in the directory are incorrect, the
file will not work.

What else the directory entry has:

32 bytes in total

It has the starting record number and file length (in records)

It may have the date/time of file creation (not supported by HP41)

It has the 2-byte value of 80 01 at (1A-1B)

The HP 82973 PC/HP-IL interface Board:

This board was designed by HP to get your PC hooked into the HP-IL loop. Once
that was done, you could do a lot of things, including use your PC keyboard
instead of those tiny HP-71B keys or store any of your HP-IL calculator files on
a DOS disk.

Warning about the HP82973: It was designed to run at the PC speed of its day
(16 MHz), and reportedly will not run reliably on today’s PC!

HP 82973 file storage:

It was pointed out earlier that having just the file is not enough,
you need the directory entry (and the File Implementation Bytes), too. When the
HP 82973 board copies a file from HP-IL to DOS, it figures out the directory
entry for the file, tacks that info onto the front of the file itself, then
stores them together in one DOS file. Presumably, it separates them again when
you bring the file back from DOS and puts it where it belongs. I wouldn’t know,
as I have not used one of these boards.

HP LIF2DOS Software

As time has shown, LIF did not take the world by storm, did not become the de
facto standard for disk storage format, and "…increasingly became a relic."
(Read HP support’s version of this at ftp://fcext3.external.hp.com/dist/mxd/pc/old/lif_over.html).
To extend the life of their product, HP worked up a software package that would
allow DOS systems to read LIF-formatted floppies. They called it the HP E2080
LIFUTIL which, although now obsolete, they still remember. HP has thankfully
"public domained" this software product, and is giving it away. Refer to http://www.tmo.hp.com/tmo/support/English/OSKR-OTS:9991:020043.html
for HP’s word. There will be a link there to follow for your own LIFUTIL
software. Download a copy of this software, and set it up so that it can be run
on your computer. This is the software that will be used to copy files
between DOS and HP-IL!

This is a super software product that will allow you to read and write to a
LIF disk from your DOS computer. Despite what HP says about it, it has worked
fine for me on Intel 486 and Pentium Processors.

Something Useful: Get and Run a file from the
Swap Disk Archive

So now with a little bit of knowledge, let’s do something useful! Take a look
at the swap file archives online at ftp://ftp.math.jyu.fi/pub/hpil/ .
Here, some kind person has taken the years of swap disks from "the old days,"
converted them to DOS format (using the HP 83973 board) and placed them on-line
for anybody to look at or download. Hey, that’s great! There’s not just HP-41
programs there, but HP71 and 75 BASIC programs, 100’s of HP71B LEX files, and a
bunch of other stuff. This is the true stuff from the glory days of HP
calculators, programs and routines from the calculator crowd at their peak… so
how do we get to them?

Don’t download them straight from the internet onto your 9114B disk drive and
expect them to run…they won’t. No! DO download them from the internet to your
hard drive. Then, use your little bit of knowledge and spend some time with the
file of your choice. Take a binary editor if you have to, and check out the
first 32 bytes of the archived file… why it looks like a LIF directory entry!
See Figure 3 - HEX Dump of HP41 Program File (DOS ftp file) for an example of
what you should see in these ftp files. Write down the things you need (File
Type, File Implementation, File Name) then get rid of those 32 bytes and save
the file. NOW, take this truncated file and pop it over to your 9114B disk
drive. Refer to Appendix I – Basic LIFUTIL Instructions for help copying files
using LIFUTIL, you have to use the special user-defined option for file type
conversion.

Voila! Now the file is on HP-IL and ready to be run!

Recap and Summary of Steps to Take: (It is easier than it appears, try it
yourself)

Download the file of interest to a local drive

Binary edit the file

Record the Important Info

Delete extra 32 bytes at start of file

Save the file back to disk

Copy the edited/shortened file to the LIF disk.

Follow the guildelines in Appendix I – Basic LIFUTIL Instructions

Copy the file from the LIF disk to your calculator

Run the file.

Figure 3 - HEX Dump of HP41 Program File
(DOS ftp file)

You may be thinking, "hey, that’s really super but there’s 1,000’s of
files in that archive, and I want them all NOW! To open each one, write down the
good bytes, then to delete 32 bytes, save, and copy… well… that’s WORK!" At
least that’s what I thought. So I wrote a routine in Visual Basic to open the
files, make a record of the file type and implementation, and delete those 32
extra bytes AUTOMATICALLY! AND, I found out another LIF to DOS routine from HP
(LIF.EXE) that can be called from a DOS Prompt Command line, so it can be run
from a Batch File (remember those?). Check out Appendix II – Automatic
Extraction of Important File Info for a summary of instructions on how to do
this. Follow these instructions, and you can retrieve files like crazy from the
old-time swap disk program!

Swap disk files from way back running on my machine now! Way cool! But what
if I have my own file that I want to distribute? Bar code is still so slow and
cumbersome! My 41’s batteries don’t have the juice left to record cards! What do
I do? Well… How about using DOS? How about using email? How about using the
internet? All the recipient needs is a 9114B disk drive and some knowledge.

Here’s what you have to do: (Refer also to Appendix I – Basic LIFUTIL
Instructions)

Put your file onto a LIF Disk.

Copy it to DOS, using LIFUTIL or LIF. Leave the file type "as-is." This
will be the file only, without any of the directory entry information.

Find your file’s entry in your LIF disk directory. It’s OK to use
LIFUTIL’s hex dump utility for this. Just dump the first 10 or so blocks to
the screen, and page through the directory entries until you come to the one
you're looking for.

Make a note of the File Type and Implementation.

Include this information in your email or web page so the recipients can
get it to their systems correctly. Since you didn't add the 32 bytes to the
file, they don't have to delete them. They do have to know the File Type and
File Implementation bytes, though.

So That’s That

Now we know how to access/use files that have been DOS-ified by the 82973A
board, even if we don’t have one. And we know how to DOS-ify HP-IL files on our
own, and what information to include with them so they can be used later on by
ourselves or others – given that we have HP-IL disk drives.

Important Information:

If you have the HP-IL/PC Interface Board HP 82973, you can ignore most of
this.

If you love creating bar code or magnetic cards, you can ignore some of this.

If you don’t have a 9114B Disk Drive, keep looking for one.

If you get a 9114B Disk Drive, it will need a new battery, located inside the
plastic battery holder. Get a direct replacement from Digi-key for $16.36
(Digi-Key Part No. P262-ND, Panasonic Part No. LC-R062R4PU).

Useful Information, or "What do Those Files DO,
Anyway?"

Pulling out files at random from the ftp archive can be fun but frustrating.
Some, but by no means all, of the files include a .TXT file that tells what it
does or have text information inside them that explains what they are. For the
rest, how does one tell what a file does just from its title? You could load it
onto a calculator and print out a listing, but that’s work, too. I’ve written a
41C program "decompiler" that will take a DOS-ified 41C file and create a text
source code listing. Special fonts have been created to address the classic "how
do you print a ‘sigma’ or an ‘append’ character" problem. The other classic
problem still exists: how to print out the correct function name instead of
XROM(xx,yy). This problem is being solved, but needs more time. Ask me for more
information on this program which is still being developed.

A word or two on Formatting LIF
Disks:

Disks formatted with the HP-41:

The HP-41 does not recognize or require disk volume labels, so it does not
create them when formatting a disk. The problem is that LIFUTIL does require
them. Since LIFUTIL expects to see a volume label, it will not acknowledge a
disk formatted by the HP-41/9114B combination. I have modified an old program to
allow the HP-41 to add a volume label to an already-formatted disk. It requires
the Extended I/O module, and details are available upon request. It’s easier to
format disks with the HP-71 (if you have one) and put a label onto it right
away.

There are some limitations regarding the maximum space or number of files
that the HP-41 can address on one disk. This seemed to cause come consternation
(or at least some programming challenges) in the days of yore, as people wanted
to get the most storage possible out of each and every floppy. With today’s
diskette prices, without a growing number of HP-IL files, and with the
capability of using DOS storage devices for mass storage, I am choosing to view
this limitation as a non-problem. Solutions and workarounds of the day are
available in the journals, if one is really concerned about it.

Formatting disks with the PC and LIFUTIL:

I have not had much success formatting disks on the PC. The program seems to
stop with an error before formatting is completed. Others have not had this
problem, so try your luck and see what happens.

A word or two on acquiring hardware:

Keep your eye on your local junk sources and government surplus auctions. Buy
what you find, keep what you need, sell the extras!

As of summer, 1999, Jim Carter of Interfab had available some HP41/71/75
accessories leftover when Educalc went out of business around December 1997.
Most applicable, he had quantities of the HP41/HP-IL Interfaces (HP 82160A)
available for $8.95 each. Call Jim at 949-582-2631.

I monitored ebay for a couple of months (summer 1999), just to see what
things were going for at the time. The results are shown in Appendix IV: HP-IL
Ebay Prices, Summer 1999 for your information.

for continuing the Swap Disk program, and for particularly useful articles
in the journals.Hewlett-Packard –
for the LIFUTIL program, for "public-domaining" the LIFUTIL and LIF.EXE
program, and for the obvious…Wlodek Mier-Jedrzejowicz –
for his tremendously useful and resourceful book, Extend Your HP41,
as well as continued support and encouragement for off-beat little projects such
as this.Richard Nelson –
for his organizational efforts over the years, especially the
editing/publishing of the club journals.Jake Schwartz –
for the PPC CC-ROM project, which made the years of journals available to
all.???? –
for starting and maintaining the ftp archives of HP-IL/LIF/Swap disk
files.My wife –
for tolerating, if not necessarily understanding, activities like
this!

Appendix I –
Basic LIFUTIL Instructions

Most of the LIFUTIL instructions are self-explanatory or at least easy to
understand. When it comes to copying files from DOS to LIF, however, some
additional information is helpful. Because LIFUTIL was not written with these
HP-IL files specifically in mind, some extra effort is needed to transfer them
correctly.

Hpilhead.xls – this Microsoft Excel file has a Visual Basic Macro which
will read from a source file (with extra 32-byte "header" info) and write the
truncated file to a destination file, while saving the file name, file type, and
file implementation bytes into a text file for later use.

Lif.exe - Another great public domained software program from HP. This one
allows DOS command-prompt execution for copying files between DOS and LIF. This
program supports user-specified file types and file implementation bytes. These
features can be combined to make a DOS batch file (.BAT) that can handle fast
copying of multiple files at once.

How to do it:

Collect and gather files from the ftp archive that you wish to copy to
LIF.

Create a listing of these files (including their directory path) in a
column in a Microsoft Excel spreadsheet.

In the adjacent column to the right, create a listing of where you would
like the truncated versions (without the LIF directory info as the first 32
bytes of the file) to be created.

Run the Microsoft Visual Basic macro contained in the HPILHEAD.XLS File

You have to have the current cell be the topmost one in the SOURCE file
column

You have to specify the number of files to be examined inside the VB
source code

Feel free to make a better user interface for this code! I don’t have
the time right now to do it.

Bear in mind that a text file with the file names, file types, and file
implementation bytes will be created in the default directory. Feel free to
make a better user interface for this, too!

Use the information in the newly created text file to create a DOS batch
file with lines of the following format:

LIF CP <source> <dest> /R /T:0x<bbnn>
/I:0x<aabbccdd>

where:

<source> = the file without the 32-byte LIF directory info in it.
Include the path.

/R = for "raw" option. Otherwise you will get extra bits in the file
that will make it not work. Trust me on this, or try it yourself and see!

0x = Number-zero, letter-x (Not LETTER-o, letter-x). This tells the
program that the following numbers are in HEX.

<bbnn> = File Type bytes. Include leading and trailing zeros, if
any.

<aabbccdd> = File Implementation bytes. Include leading and
trailing zeros, if any.

Run the batch file you created, and watch the files fly back to LIF!

Appendix III: LIF File Types

This table shows a listing of all the LIF File Types that I could find
information on. These come from various locations in the journals and the ftp
archive. I have not verified them all, as I have not seen some of the file
types.