![]() |
ILPilsim is a software to build a bridge between Jean-François Garnier's DOS based HP emulators Emu41, Emu71/DOS and Emu75/DOS and Virtual HP-IL (Hewlett Packard Interface Loop). These DOS based emulators still have a COM port interface to connect a PIL-Box with firmware version 1.6 or earlier directly. This opens the possibility of using additional virtual devices and even more the usage of the PIL-Box hardware with the latest firmware revision. |
Modern PC's using Windows regularly have problems running such DOS programs. The main problem is that most people run the 64bit variant of this operating system. This version cannot execute 16bit DOS programs directly any more. For running such programs on 64bit we need a virtual DOS environment like DOSBox or a DOS operating system running in a virtual machine (VM). Moreover Windows is a multitasking, multiuser OS protecting and synchronizing hardware access and so serial transfers without interrupt and buffer capabilities like the current DOS based emulators may run into buffer overflows. But even when you are still using a Windows version in the 32bit variant, you may install a VM to get the benefits of the serial port redirection.
The 'ILPilsim - Pilbox-Simulation' contains a server for TCP/IP and named pipe to capture and handle the forwarded serial traffic from the emulator, a very rudimentary PIL-Box simulation to handle the PIL-Box byte protocol and a TCP/IP interface to implement Virtual HP-IL. It's important that the emulator/controller use the PIL-Box 9600 baud protocol with ACK and not the protocol for higher baud rates without ACK. Don't forget to enable the PIL-Box support in the emulators INI file with "XIL COM1".
Important notice: Start the server in ILPilsim before starting the DOSBox program or the DOS in a VM, otherwise the serial redirection isn't working!
In my humble opinion the easiest way is to use DOSBox 0.74-2 in connection with the TCP/IP server of ILPilsim.
Because of a serious internal problem in the prior version 0.74 corrupting memory and files under some circumstances in connection with redirected COM ports, it's strongly recommended to use DOSBox 0.74-2. The bug in 0.74 was reported by some people using Emu71/DOS copying a file from a ILPer disk drive to the internal disk drive. A further investigation by Jean-François showed an invalid pointer returned by the file subsystem of DOSBox.
I made the tests with a Windows XP x86, Windows 7 x64 and a Windows 10 x64 host. The serial settings are a little bit tricky so it took some time to get a working configuration. I got best results with the following setting in the dosbox-0.74-2.conf file:
[serial] serial1=nullmodem server:localhost port:59999 transparent:1 txdelay:0 rxdelay:0
Very important is the "transparent" setting. This disables the handshake control. The "txdelay" value controls the transmit speed and finally with "rxdelay" we remove additional delays normally for avoiding buffer overruns.
In the beginning I wasn't able to get DOSBox working so I used the VM's VirtualBox 5.2.18, VMware Workstation Player 12.5.9 and 14.0.0 and a .vhd disk image containing FreeDOS as operating system. Any other combinations of VM and DOS may work also. VirtualBox allows to redirect the COM ports as TCP client or, on a Windows host, as named pipe, whereas VMware Player only as named pipe. Another difference, VirtualBox 5.2 support x86 and x64 hosts whereas the recent versions of VMware only x64 hosts.
I highly recommend to use VirtualBox on a Windows host as VM, the output over Virtual HP-IL it is over 20 times faster comparing to VMware. When using VirtualBox I recognized no speed differences on the serial port redirection between the usage of TCP and named pipes. For more information about installing a VM and DOS read the corresponding manuals please.
After starting ILPilsim displays a window with three parts: 'Emulation Link', 'HP-IL Link', and four buttons. These do almost what you expect:
But first you have to do some setup.
As mentioned earlier, ILPilsim has two servers to capture the forwarded serial traffic. Dependent on the given data in the "TCP/IP Port or Pipe" field, the TCP/IP or the named pipe server is selected.
Simple enter the port address like "59999" in the edit field.
Named Pipes always begin with "\\.\pipe\" followed by the pipe name. So "\\.\pipe\pilpipe" is a valid input for a named pipe.
HP-IL Link is the part to enter the settings for the virtual HP-IL over a PC network. ILPilsim has an integrated TCP/IP client to transmit the IL frames over the virtual loop and a TCP/IP server for receiving the HP-IL frames from the loop.
Choosing TCP/IP (IPv4/IPv6) as transport protocol gives the advantage of communicating with virtual HP-IL devices around the world if the host PC has access to the Internet. Each virtual HP-IL device contains a TCP/IP server listening for data frames on the specified port number and a TCP/IP client sending data frames to a port of the next virtual device. A HP-IL data frame is normally 11 bits long, but as TCP/IP is a byte oriented protocol it is mapped to 16 bits (2 bytes). The remaining upper five bits are filled with zero (reserved for future use). The two bytes of a frame are transferred in network byte order.
Therefore you have three virtual HP-IL mode parameters:
The "Out TCP/IP Address" identifies the host PC with the next virtual HP-IL device. If the next device is on the same computer use "localhost" or "127.0.0.1" for IPv4 or "::1" for IPv6 as TCP/IP address, otherwise the DNS name or the TCP/IP address of the next computer. (A device may be a simulated device or an IL frame sniffer.)
The TCP/IP Port number represents in the simulation a physical HP-IL cable. It must have the same number as the "In Port" of the subsequent device on the virtual IL.
Here you must enter the same number as on the "Out Port" of the previous device on the virtual IL.
So each device is listening for HP-IL frames on it's in-port, processes the frames inside the device simulation, and send output frames to it's out-port.
The Port numbers are split into three groups:
For virtual IL you should use port numbers from the third group (49152-65535). Port numbers below 49152 are also accepted.
Open TCP/IP ports are nowadays a security problem when your PC is connected to the Internet. To protect your computer from unauthorised requests all modern operating systems contain a (personal) firewall which blocks attacks. By default all ILPilsim TCP/IP traffic is being blocked too. Depending on your firewall you are asked at first usage of ILPer in TCP/IP mode to permit the communication or you must beforehand enable manually the ILPer program in your firewall. For security reasons you should restrict the rights of ILPilsim to the local PC or not more than to the local LAN.
After you finished the setup press the "Start" button to allow data transmission.
ILPilsim can save the setup data in two ways. The standard way is saving the data in the Windows registry. But then every instance of the program starts with the same settings. To avoid this I added the possibility to use a dedicated ini-file.
The command line arguments "setup-file" and "/start" are optional and their order is irrelevant.
is the file (file name optionally with path) to hold the setup data of the program instance. The data is written to the file when you exit the program.
will activate the "Start" button automatically after program start-up.
A batch file containing
start /min ILPilsim.exe /start ILPilsim.vil start Ilper.exe /start ILPer1.vil start Ilper.exe /start ILPer2.vil
is starting the ILPilsim instance minimized reading the setup data from the file ILPilsim.vil and two instances of ILPer, one using the setup data from file ILPer1.vil, the other from file ILPer2.vil. At all three programs the "Start" button will be activated after start-up.
For the setup-files I suggest the file extension *.vil (for Virtual Interface Loop) but any other file extension will do. Creating the *.vil setup files from the example above is quite easy. Run the batch program to start all program instances, arrange the program windows on the screen and setup each program instance with the correct data. Finally close all program instances. At the next call of the batch file, all program instances are restored at the previous screen position and use the last setup data.
(c) Christoph Gießelink, February 2024