[Home]

Parallel Port Passthrough and Virtual Printer Patch

Contents
  1. Assigning a device to a LPT port
  2. Parallel Port Passthrough
  3. Virtual Printer

Assigning a device to a LPT port

Under the [parallel] section in dosbox.conf the LPT1-3 ports can be assigned a device. The currently supported values are:
  • parallelx=disabled
  • Disables this port
  • parallelx=reallpt
  • Parallel Port Passthrough - additional parameters can be added on the line
  • parallelx=printer
  • Virtual Printer - parameters are set in the [printer] section - there can only be one virtual printer
If you activate the disney sound device, LPT1 is overridden. So if you want to use the passthrough or virtual printer leave disney disabled.

Emulated interfaces for all types of devices:
  • I/O at 378h/278h/3BCh
  • BIOS INT17
  • DOS INT21
  • DOS file (PRN/LPTx) access
  • DOS handle #4 access

Parallel Port Passthrough

It's good for i.e.:
  • printers
  • dongles
  • actuator cards with not too strict timing requirements
Requirements:
  • Windows (Win9x, NT, Win2000, XP32, Vista32) or Linux as host operating system
  • For Windows, a ECP/EPP or SPP register compatible parallel port is required
  • For Windows, the Porttalk driver has to be installed on the system
Limitations:
  • Interrupt from parallel port is not supported
  • Parallel Port to USB adapters are not supported
  • Some modern parallel ports may not be compatible with older hardware
  • Timing issues with emulation can give improper results or cause faliure with certain applications
  • It does not work with USB-Parallel adapter cables or nonstandard parallel ports (Windows)
First you need to install the PortTalk driver and once run allowio to get PortTalk installed. It is not required to use allowio every time you start DOSBox.
Set parallel1=reallpt in dosbox.conf. If you use a parallel port different from the standard LPT1 built on mainboards, you need to specify the port's base address. This can be looked up in the Windows device manager.
Example: parallel1=reallpt realbase:cc00
Entering a wrong I/O port address can mess up your system, so doublecheck what you write there.

Debug Log
Thi build has parallel port debugging enabled which is useful for reverse-engineering old communication protocols. The actions a program performs on the parallel port are recorded in a text or binary files located in the capture subdirectory. The different types of actions can be filtered in the following categories:
  • dbgdata - write a info line (timing, value) when the parallel port's data port is written
  • dbgput - write a line when data is written to LPT1/PRN
  • dbgregs - write a line when any registers of the parallel port are accessed
  • dbgputplain - only write bytes that are written to LPT1/PRN as file
  • dbgdataplain - only write bytes that are written to the data register
  • dbgall - all debugging parameters except plain
The desired categories are added to the parallelx configuration parameter, i.e.:

parallel1 reallpt dbgput dbgregs
parallel1 reallpt dbgputplain

Virtual Printer
The Virtual Printer emulates a color dot-matrix printer that follows the ESC/P2 printing standard.
Features:
  • Many of the ESC/P and ESC/P2 instructions supported
  • Graphics printing for 24-pin and 48-pin modes supported, up to 360dpi
  • Color output, use "Generic ESC/P 24pin wide" printer on Windows 3.11 or "Epson SQ 860" on Win95
  • Data can be output as Windows bitmap, PNG file, Postscript file, or sent to a Windows
  • Some older non-conflicting IBM control codes are supported
Limitations:
  • Windows printer output in black & white only
  • Not all ESC/P commands are yet supported, like custom fonts
  • The default font (roman.ttf) is ugly and characters are misplaced, you may want to replace it with one of the others
  • Due to overexact graphics emulation 360dpi printing from Windows (guest) graphics rastering might not look as expected
  • When set to use a Windows printer, the printer dialog will only show up once at start
  • Country code setup and other configuration buttons found on a printer are not availible, this may be overcome by sending special ESC/P commands to the printer before printing
The virtual printer adds the following parameters in the dosbox.conf under [printer]:
  • printer
    true enables the virtual printer. Handy if you'd like to use it.
  • dpi
    Resolution of printer (default 360). 180 is another one that makes sence.
  • width
    Width of paper in 1/10 inch (default 85 = 8.5')
  • height
    Height of paper in 1/10 inch (default 110 = 11.0' US Letter)
    For other paper formats, see Paper size on Wikipedia
  • printoutput
    Specifies how to save the output of the printer.
    • png
      Saves to a PNG file (default)
    • ps
      Saves to a Postscript file
    • bmp
      Creates BMP images (very huge files, not recommend)
    • printer
      Send to an actual printer (Print dialog will appear)
  • multipage
    Adds all pages to one Postscript file or printer job until CTRL-F2 is pressed.
  • docpath
    The path where the output files are stored. Default is the DOSBox program directory.
  • timeout
    (in milliseconds) if nonzero: the time the page will be ejected automatically after when no more data arrives at the printer. Useful when the DOS program does not do that itself.

Convincing the printer to produce output

There are several conditions under which the virtual printer will output a page.
  • No more text fits on the current page
  • The DOS program sends a formfeed character or toggles autofeed on the parallel port
  • The user presses CTRL+F2
  • If the timeout value is set and no more data has arrived in the timespan