How does HP-IL Emulation for HP-41X work?

HP-IL (Hewlett-Packard Interface Loop) is emulated via serial (RS-232) port of the HP-48GX and HP-49G calculators. Emulation via IR isn’t possible. In order to use HP-IL, the following items are needed:

(*) HP-IL enabled version of HP-41X,
(*) HP41Z library containing the HPIL module,
(*) HP-IL server for Microsoft Windows 95/98/Me/NT/2000/XP/2003.

HP-IL enabled version of HP-41X is responsible for the lowest level of communication. HP-41X emulator communicates with the HP-IL server at the speed of 9600 bps. Because of many reasons, HP-IL emulation on HP-41X is slower than on HP-71X but still fast enough for normal work.

The 15360 bps speed could be used with HP-41X without problem but it is not supported under most operating systems (in fact, it is supported only with some older versions of Windows 95) so it has been abandoned.

Strictly speaking, this form of connection between HP-41X and the computer (technically) is not a “loop” at all because RS-232 is meant to connect two devices together directly. If all of loop functionality has to be implemented via RS-232 with frames bouncing forwards and backwards, the speed of communication would be very slow and the emulation would be useless. So, many things have to be done differently. The emulation appears as the real loop to the HP-41X but the communication protocol is very different.

Some features, like parallel polling, are left out because I haven’t found any practical use for them in this implementation (yet). But, if they will be needed in the future - they can be implemented with ease.

HPIL module is fixed to page 8 because page 7 is already occupied by HEPAX module and moving HEPAX to another page would complicate and slow down the emulator (bank-switching problems). All calls and jumps to page 7 are automatically redirected to page 8 inside the emulator by the process called “mirroring” which enables external modules to “see” HPIL module as it appears on page 7. This is transparent to the user and internal/external modules. While HEPAX may not be visible for external modules in this case, all it’s functions are still accessible. Even more - HEPAX module and HPIL module can be used simultaneously despite the fact they are virtually on the same page!

HP-IL server for Windows contains all HP-IL devices which are supported by the emulator.
Currently, the following devices are implemented:

Address 1: Display device (AID=#30, ID=”CONSOLE”)
Connection to the standard Windows character console (compatible with the the HP-82163 video interface).
Codepage is MS DOS 437 with some characters remapped to match the original HP-41C character set.

Address 2: Tape device (AID=#10, ID=”CASSETE”)
Virtual tape device compatible with the HP-82161A cassette drive.

Address 3: Parallel port device (AID=#4E, ID=”LPTPORT”)
Connection to printers and another devices via the parallel PC port (output only).

Address 4: Printer device (AID=#2E, ID=”PRINTER”)
Connection to the Windows printers.

Address 5: Serial port device (AID=#4E, ID=”COMPORT”)
Connection to printers and another devices via the serial PC port.

Address 6: Input device (AID=#4E, ID=”INPUT”)
This device provides file input interface to the Windows file system.

Address 7: Output device (AID=#4E, ID=”OUTPUT”)
This device provides file output interface to the Windows file system.

Address 8: Virtual thermal printer device (AID=#20, ID=”HELIOS”)
Although I am calling it 'Helios', it is the emulation of HP-82162A HP-IL thermal printer.

Features of thermal printer emulator:

(*) Both ASCII and 8-bit modes are emulated.
(*) Both ASCII and 8-bit character sets are supported.
(*) All escape sequences are supported.
(*) Double wide and column graphics modes are fully emulated.
(*) Bar code mode is emulated (bar code printing is horizontal).
(*) Two output modes: Virtual screen output and hard output to Windows printer.
(*) Number of virtual printer rows can be configured.
(*) All output is captured into PRINTER.TXT file as text (it is cleared on start).
(*) Saving virtual printer output into bitmap is possible.
(*) Easy keyboard and mouse navigation on virtual printer.
(*) Despite the screen representation, which is 24 characters (168 dots) wide, the actual line width on the printer is 380 dots so you can utilize the whole paper. This is also the reason why Parse/Non-parse modes aren't implemented.
(*) The size of printer buffer is unlimited.
(*) HP-IL Printer Module is modified to allow easy accumulation of codes >=128.


Man: Activate MAN mode.
Norm: Activate NORM mode.
Trace: Activate TRACE mode.
Rows: Number of rows for screen output.
Start: Activate/start printing on the default Windows printer.
Print: PRINT button as on HP-82162A.
Adv: ADV button as on HP-82162A.

The procedure for printing on the Windows printer is as following:

(*) Press Start button to activate printing.
(*) Execute all print commands/instructions needed.
(*) Press Start button again to finish accumulation and start printing.

If you don't need the full HP-IL emulation but want only to print then it is much better idea to use my HP-82143A Helios Thermal Printer Emulator for direct printing because direct unidirectional communication at 9600 bps is much faster than bidirectional HP-IL emulation over RS-232.

All above addresses are default addresses after AAU. HP-41X is always adressed as the last device. Extended and multiple addresses are not used.

Console (1) and Printer (4) devices capture their output to the CONSOLE.TXT and PRINTER.TXT files. These files are cleared automatically on the first access after start of the HP-IL server or can be cleared by the Device Clear HP-IL command (CLRDEV from EXT-IO ROM).

Input device can be used to copy files from the Windows file system (disk drives) to the emulator. The default input file is INPUT.DAT in the HP-IL server directory. If you want another input file then initialize (open) it with CLRDEV (from EXT-IO ROM), enter the filename into the HP-IL server (dialog box will be automatically opened on the server side) and use appropriate commands to copy the content from the file. Output device can be used to copy files from the emulator to the Windows file system. The default output file is OUTPUT.DAT in the HP-IL server directory. If you want another output file then initialize (create) it with CLRDEV, enter the filename into the HP-IL server and use appropriate commands to copy the content to the file. You will need to execute MANIO and SELECT prior to using these devices.

All parameters of the HP-IL server can be changed via front panel. Furthermore, HP-IL message monitor can be activated for debugging purposes in cases when something went wrong and the communication must be inspected at the frame level. HP-IL monitor doesn’t monitor data messages. Sending data from server to the HP-41X is available as well. HP-41X can service SRQR, FRAV and FRNS interrupts as well (with the aid of HP-IL Development Module - DevIL). For example, PRINT and ADV buttons on HP-82162A printer are working properly.

It is only possible to connect the controller (HP-41X on HP-48GX/49G) directly to the server on the PC. The server emulates an internal “loop” of devices inside itself. That’s what I am using them for: to connect HP-41X to external console on PC, to use printers connected to PC, to use virtual tape drive on PC, etc, etc. When I will need another peripheral, I could emulate it and add the appropriate device to the HP-IL server.

Communication with the real HP-IL devices through HP-IL card isn’t possible (and won’t be implemented) because this card doesn’t work in a new PCs with only PCI slots and it is only supported under MS DOS (or in a MS DOS box). HP-41X (as all my other emulators) are designed from start to use only existing and standard hardware such as HP-48GX and HP-49G calculators, PC computers, printers supported under Windows and other devices which can be connected to PC via parallel and serial ports. Honestly, I am not too much interested in supporting 20 year old equipment bought on eBay.

Helios Printer emulation can be used simultaneously with HP-IL emulation without problem. HP-IL Printer module is supported as well. Exchange of both types of printers is very simple. If, at startup, the emulator finds a printer module (either Helios or HP-IL) on page 9 (loaded from HP41Z, for example) it will automatically load it to page 6 and free page 9 so it can be used for some other module or as a HEPAX RAM. For this, the card containing the emulator should not be write protected.

Installation guide for HP-41X version of HP-IL emulation is here.

Please, keep in mind that HP-IL emulation for HP-41X is not a free software.
It is a part of HP-41X and, if you want to buy one, you can find the necessary info here.
Demo version of HP-41X can be obtained at request.