The HPDrive Project

Why and how

If you got a working 9845 system you probably want use some mass storage as well. Since today most of the built-in tape drive systems fail (and because using those tape drives as storage - even if they do work - is not recommended anyway), another type of mass storage peripheral is needed.

If you own one, a floppy disk drive like the 9895A is certainly a good choice, of course in combination with the appropriate 98034A/B HP-IB interface. If you can't find a 9895A drive or any other mass storage in working condition, emulating a real vintage drive on a conventional PC is an attractive alternative. Since the 98034A interface is the only peripheral interface which is directly supported by the 9845 operating system (besides the 98041A disc interface), it is probably a good idea to build this emulator for use with an HP-IB connection. At the PC side, only a suitable interface card is needed, plus the emulator program itself.

Beyond replacing a vintage HP-IB mass storage drive, an emulator has some additional advantages:

Sure, an emulator will never really replace the feeling with a real vintage drive, reading real vintage floppies, making all that noise, and drawing lots of power. But it can be quite useful, especially if you don't own other mass storage in working condition.

So I decided to do all that work, scanning all the HP-IB commands which go forth and back between a 9845 host and the peripheral, checking out the manuals which describe higher level HP-IB based command sets like the AMIGO command set, finding out how to low level program those GPIB boards under modern operating systems and whatever was needed to get this task done.

The result was a mass storage emulator program, the HPDrive utility. HPDrive runs as a console application under Windows 9x, ME, NT, 2000, XP and Vista. It is, in a first version, limited to the AMIGO command set, which was one of the early semi-device-independent peripheral command sets over an underlaying HP-IB connection. This protocol was quite popular at the time of the 9845s, and even the systems which followed the 9845s like the series 80 or series 200 systems mostly supported AMIGO based drives like the 9895A, the 82901 or the 9121. I started testing with the CS80/SS80 command set, which was a successor of the AMGIO command set, but since I don't own a real 79xx drive, it is hard to guess the timing for the protocol which actually passes the HP-IB bus.

HPDrive in its current version still is very basic, since it only implements those AMIGO commands, which are really used from the 9845 host system. I've added some support for the HP Series 80 as well. So it is not impossible that other systems run into problems with the current version. If that happens, please just report the type of system you are using and make a protocol of the command sequences which caused the error (see below how that can be done).

The AMIGO Command Set

In 1978 HP released a new multi-user computing system called HP 300. Although technically ahead of time, it wasn't much successful. One of the design principles of the HP 300 was to utilize the HP-IB for peripheral communication. In order to standardize the operation of mass storage equipment, a special command set was defined, which could be used to initiate and control operations like formatting and initializing media, reading and writing data, doing status reporting, performing diagnostics and some others. The name of the HP 300 operating system was AMIGO, so the command set was named AMIGO command set.

The basic principle of the AMIGO command set was to implement high level commands by sending HP-IB commands and by sending and receiving data. In general, each AMIGO command consists of four steps:

  1. First the peripheral device is addressed as either listener or talker (depending if it was intended to write data to or to read data from a device).
  2. Next a secondary command is issued, indicating the command group (e.g. read data) the command belongs to. If there are more than one command in the command group, the specific command is identified by an extra byte, the operation code.
  3. If appropriate, a number of parameters can be issued or data from the peripheral device can be received.
  4. Finally the command sequence is completed by the HP-IB untalk or unlisten command.

Some operations need two commands for one complete operation, for example the device status is first requested with one command and then the data is acquired with a second command.

The AMIGO command set is closely bound to the HP-IB protocol. Some techniques used by the AMIGO directly utilize features of the HP-IB. So device identification is done by the so-called AMIGO identify, which is just an HP-IB untalk, followed by a secondary which carries the address of the target device, which then should send its two-byte identification code as reply. This AMIGO identify still causes a lot of problems, since on one side its non-standard use of the IEEE-488 bus irritates some of the IEEE-488 PC cards, and on the other side it prevents the 9845 from operating with peripheral devices which - although they understand the AMIGO command set - are rejected just because the 9845 strictly works only with specific known device IDs. Even worse, because of the non-standard nature of this command, the AMIGO identify is extremly hard to implement since it requires register level access. The current NEC µPD7210 implementation is based on using the HP-IB UNTALK command (31) as second board address, which is not possible on other GPIB controller chips like the TMS9914 or high-level interfaces like NI 488.2.

Another example for an implementation very close to the HP-IB is the way the peripheral device holds off the host from sending commands too quickly (i.e. sending a command before the processing of the preceding command has not yet been finished). This hold-off mechanism is based on the HP-IB parallel poll feature. As long as a peripheral device is busy, it just deactivates its response to a parallel poll. So when sending a command to a peripheral device, the host should send parallel poll requests in short intervals until the poll is successful, just to be sure that the next command can be accepted. This mechanism is the reason why only primary addresses between 0 and 7 should be used for mass storage devices, since the parallel poll answering line is directly coupled with the address (address 0 uses line 7, address 1 uses line 6 etc.). It is obvious that such a polling mechanism is not as efficient as a request-reply scheme, but it works.

The AMIGO command set was implemented in the 9845 as well as in a couple of mass storage devices. As stated above, some of those devices are not supported by the 9845 just because the 9845 rejects their identification code. Here are the devices which implement the AMIGO command set, and whether they are supported by the 9845 or not (note that there are combo and non-combo variants for most base types):

  Name Type Support Base ID Units
  9895A 8" Floppy Disc HP1,SSS 9895A $0081 2
  82901M 5.25" Floppy Disc SSS 82901 $0104 2
  82902M 5.25" Floppy Disc SSS 82901 $0104 1
  9121D 3.5" Floppy Disc 2) SSS 9121 $0104 2
  9121S 3.5" Floppy Disc 2) SSS 9121 $0104 1
  9133A Hard Disc & 3.5" Floppy Disc Combo 1) SSS 9134A $0106 1+1
  9134A Hard Disc 1) SSS 9134A $0106 1
  9135A Hard Disc & 5.25" Floppy Disc Combo 1) SSS 9134A $0106 1+1
  9133V Hard Disc & 3.5" Floppy Disc Combo 1) 3) SSS 9134A $0106 1+1
  9133B Hard Disk & 3.5" Floppy Disc Combo SSS 9134B $010A 1+1
  9134B Hard Disc SSS 9134B $010A 1
  9133XV Hard Disc & 3.5" Floppy Disc Combo 3) SSS 9134XV $010F 1+1
  9134XV Hard Disc 3) SSS 9134XV $010F 1
  7910 Hard Disc HP2 7910 $0001 1

Notes:

Footnotes:

1) may be configured as 4-unit logical 9895A drive with 1.15 MB for each unit
2) physical media format is 3.5" SS/DD with 70 cylinders, identifies as 8290xM
3) floppy drive in combo emulates 3.5" (9121S) floppy disk drive (extended command set)

The AMIGO command set was later replaced by the CS/80 command set (CS is just an acronym for 'command set'). Main features of this new command set were a new device independend channel model, as well as support for tape storage and for device dependend subroutines. A special subset with a restricted number of commands and parameters was defined in order to simplify implementation especially for smaller mass storage devices. This subset was consequently named SS/80. The SS/80 protocol was used by smaller drives including the 9133D/H/L, the 9134D/H/L, the 9122D/S, the 9153A and the 9154A. The 9845 has some basic support for CS/80 drives, namely the 7908, 7911 and 7912 drives, which are supported by the Mass Storage ROM Rev. C and later. The largest drive storage supported by the 9845 is a CS/80 drive, too: the 7933/7935, which provides up to 3x404 Mbyte = 1.2 GByte (!) storage to the 9845.

Specifications of the AMIGO command set can be found as part of several peripheral device manuals (e.g., the 9895A service manual, see hpmuseum.net for download). Note that not all AMIGO features are implemented by all peripheral devices. Specification of the CS/80 command set can be found in the CS/80 Instruction Set Programming Manual which is available for download here. A specification for the SS/80 command set can be downloaded here.

Implementation Challenges

Emulating an AMIGO or CS80 mass storage device is not an easy task for several reasons.

The most severe problem lies in the implementation of the AMIGO identify command, which is used both with the original AMIGO and the CS80 command set. As already mentioned above, this command consists of an HP-IB UNTALK with a following secondary command holding the primary address of the drive, which is completely non-standard with respect to IEEE488. The reason why HP designers did chose this way of identification is not completely clear. As a matter of fact, it prevents many non-HP mass storage solutions to work together with HP computer systems. If a device doesn't respond on an AMIGO identify with the appropriate reply, HP's HP-IB system software will refuse further communication with the device. And it makes it impossible to use high-level interfaces for PC GPIB controller boards, since those high-level APIs generally implement the IEEE488 standard only. The current NEC µPD7210 implementation therefore operates on register level and uses a special, NEC µPD7210 specific hack to get the AMIGO identify command working.

Another difficult aspect is emulating the correct HP-IB hold-offs and timing. If the emulator doesn't behave exactly like the original device, communication with HP computer systems will result in a sequence of communication errors. What makes proper timing even harder to implement, is that the emulator should run on platforms with different performance classes. However the timing resolution available under Windows within User Level is one millisecond, which is far too long for controlling proper HP-IB timing. And writing real GPIB drivers for several GPIB boards under Windows is beyond this project.

With respect to the problems mentioned above, the current NEC µPD7210 implementation seems quite stable, however it has been tested only on a 200 MHz Pentium based PC with Windows ME installed (this should be considered as the 'reference system'). The reason why such an old-fashioned hardware was chosen goes back to the fact, that almost all GPIB boards using the NEC µPD7210 are ISA boards, which requires the use of older PCs with appropriate ISA expansion slots.

The HPDrive Mass Storage Emulator

HPDrive implements all AMIGO commands which are used by the HP Mass Storage ROM, and can be configured to emulate at least the following AMIGO drives:

Drive 82901 9121 9895 9134A 9134B 9134XV 7910
ID $0104 $0104 $0081 $0106 $010A $010F $0001
Image Size 286,720 286,720 1,182,720 4,856,832 9,713,664 14,570,496 12,042,240
Phys. Cylinders 35 35 77 306 306 306 735
Phys. Heads 2 2 2 2 4 6 2
Phys. Sectors/Track 16 16 30 31 31 31 32
Phys. Records 1,120 1,120 4,620 18,972 37,944 56,916 47,040

Note: All drive parameters are shown as reported through the HP-IB interface, the actual physical media characteristics may differ (e.g. for the HP-IB interface, the 9121 emulates a 35-cylinder 2-head 82901 drive, but actually is a 70-cylinder single-head floppy disc drive).

Here are the 9845 file system characteristics for each drive:

Drive 82901 9121 9895 9134A 9134B 9134XV 7910
Interleave Factor 7 7 7 7 7 7 1
Sectors per Track 16 16 30 31 31 31 32
Accessable Tracks 66 66 150 608 1,220 1,830 1,470
Accessable Records 1,056 1,056 4,500 18,848 37,820 56,730 47,040
System Start 0 0 0 0 0 0 0
Directory Start 1 1 1 1 1 1 1
Directory Size 8 8 22 92 123 123 143
Alloc Table Start 9 9 23 93 124 124 144
Alloc Table Size 7 7 7 62 62 62 48
Spare Dir Start 17 17 31 156 187 187 193
Spare Alloc Start 25 25 53 248 310 310 336
File Area Start 32 32 60 310 372 372 384
System Tracks 2 2 2 10 12 12 12
Data Tracks 64 64 148 598 1,208 1,818 1,458
Data Records 1,024 1,024 4,440 18,538 37,448 56,358 46,656
Max. Total Storage 270,336 270,336 1,152,000 4,825,088 9,681,920 14,522,880 12,042,240
Max. Data Storage 262,144 262,144 1,136,640 4,745,728 9,586,688 14,427,648 11,943,936
Max. Dir Entries 128 128 352 1,488 1,968 1,968 2,288
Spare Tracks 4 4 4 4 4 6 0

Note: all size and position information is denoted with reference to 256-byte-records, except the max. total and data storage, which refers to bytes.

As we can see, the mass storage support of the HP9845 with HPDrive goes up to the scale of at least 15 MBytes. Actually the limitation of file names to six characters in combination with the absence of subdirectories makes it hard to use larger storages with an HP 9845 anyway. Even the LIF filesystem format with its 10 character wide filenames lacks subdirectories. Actually, SDF (the structured directory format) was the first HP file system which had been designed for larger mass storage systems. However HPDrive doesn't care about file systems, it just simulates the drive hardware and firmware.

HPDrive runs as a console application under Windows 9x, ME, NT, 2000, XP and Vista. Accessing IEEE488/GPIB hardware under Windows NT/2000/XP/Vista requires the installation of the free DlPortIO driver package prior to use.

HPDrive currently supports NEC µPD7210 compatible IEEE488/GPIB interface cards. This probably covers a large amount of existing cards, since many of them can be operated in a NEC µPD7210 compatible mode. And, since almost all µPD7210-boards are ISA boards, they are generally cheap. I've planned to add support for TI TMS9914A chip, however I am still working on how to implement the non-standard AMIGO identify command with a TMS9914A. There is also the objective to add support for an NI-488.2 interface (all NI cards), however the problem with the AMIGO identify is basically the same.

The HPDrive program is free software and the source code is distributed under the GNU public license. Any contributions to this program (e.g., added support for other IEEE488/GPIB interface boards, Linux ports etc.) are welcome.

Usage of HPDrive is extremely simple, just execute

hpdrive -scan

to make sure your IEEE488/GPIB interface board is supported by HPDrive. If no supported hardware is found and you are sure your interface board has at least a µPD7210 compatibility mode, consult your board's documentation how to configure it into the 7210 mode. I/O base address setting should not matter, since HPDrive automatically scans all possible base addresses, however interrupt and DMA settings may conflict with other installed boards.

If HPDrive has found a compatible board, execute

hpdrive

without any parameters. HPDrive will ask for image files to be used as drive storage, create them if necessary, and then start emulating an HP 9895A floppy disc drive. HPDrive normally operates silently and just reports if something didn't work as expected, however you can use the -d option to show drive activity (see below).

Generally, HPDrive is invoked with the following syntax:

hpdrive [options][<image> ... ]

All other options are used to configure the emulated drive or for diagnostics. Below is a summary of all options. Execute HPDrive with the -h option for a summary. Also have a look into the README file for up-to-date information.

Option Description
-h Output a summary of the command line options.
-d Shows drive activity in terms of seek operations, including the affected records. Seek position refers to the current record address. There is one seek indicator for each unit.
-scan Check for compatible IEEE488/GPIB interface hardware.
-9895 Emulate an HP 9895A dual 8" floppy disc drive with 1.15 MByte per floppy disc (this is the default).
-9121 Emulate an HP 9121D dual 3.5" floppy disc drive with 750 kByte per floppy disc.
-82901 Emulate an HP 98901M dual 5.25" floppy disc drive with 750 kByte per floppy disc.
-9134A Emulate an HP 9133A/9134A/9135A/9133V 5 MByte hard disc drive
-9134B Emulate an HP 9133B/9134B 10 MByte hard disc drive
-9134XV Emulate an HP 9133XV/9134XV 15 MByte hard disc drive
-7908 Emulate an HP 7908 hard disc drive with 11 MByte hard disc
-a <address> Use <address> as primary GPIB address. If omitted, the address defaults to 0. The possible address range is from 0 up to 31, however due to the parallel poll hold-off, only addresses from 0 to 7 should be used for mass storage devices. Address 21 is defacto reserved for the system controller.
-n <numdrives> Use <numdrives> drives. Default for all floppy drives is 2 and for hard drives 1, however the number of emulated drives ca be freely chosen within the supported unit range (normally up to 4 units can be addressed by the 9845).
-b <board> In case more than one compatible IEEE488/GPIB board has been detected, a specific board can be selected with this option. <board> refers to the position at which the board is listed with the -scan option. Default is 1 (first board detected).
-lf <logfile> Print all output into <logfile>. Useful especially for diagnostics in combination with the -l option.
-l <loglevel> Specifies detail of HPDrive's reporting. Possible values are
0 (=silent operation, no output except errors),
1 (=output errors and warnings only),
2 (=like 1 plus some basic information - this is the normal mode),
3 (=like 2 plus detailed logging of all HP-IB activity),
4 (=like 3 plus verbose reporting of all data which passes the HP-IB)
-e <eoi-delay> Specify delay between sending the last data byte and asserting the EOI line (default value is 500).
-s <send-delay> Specify delay between releasing hold-off and start sending in ms (default delay is 0).
-r <recv-delay> Specify delay between releasing hold-off and start receiving in ms (default delay is 0).
-v Show version info.
-license Show license info.

The HPDrive program can be shut down at any time by CTRL-C.

Downloads

Click here for downloading HPDrive:

HPDrive 1.01 beta Windows 9x/ME executable: hpdrive-101beta-bin-win9x.zip
HPDrive 1.01 beta Windows NT/2000/XP/Vista executable (needs DlPortIO drivers):: hpdrive-101beta-bin.zip
HPDrive 1.01 beta source code package: hpdrive-101beta-src.zip

This first beta version may still have a couple of bugs. Please use the contact feature to let me know if something doesn't work as expected.

The DlPortIO driver package can be downloaded here.

Working with Binary Images

The image files which are used by HPDrive can be accessed by another utility, the HPDir program. Besides copying files to and from an image file, HPDir supports a number of other operations on images, like creating and initializing images, generating directory listings, creating and deleting different types of files inside an image, setting file attributes and much more. See the HPDir Project for information on this program.

Troubleshooting

Use the options "-l 4 -lf <logfile>" to create a detailed log of what has happened.

See the README in the HPDrive package for troubleshooting procedures.