How MS-DOS 6.22 Manages LPT1 and LPT2 Parallel Ports

MS-DOS 6.22 manages parallel communication ports like LPT1 and LPT2 by combining low-level ROM BIOS hardware detection, character device abstractions, and software interrupt handlers. Rather than communicating directly with hardware registers at the operating system level, MS-DOS relies on memory structures initialized during the system boot sequence to map logical port names to physical hardware addresses, providing user-accessible commands and programmatic APIs to transfer data to printers and other parallel devices.

Hardware Detection and the BIOS Data Area

During the Power-On Self-Test (POST), the system ROM BIOS scans specific I/O base addresses traditionally assigned to parallel port adapters: 0x3BC (often used by legacy monochrome display and printer adapters), 0x378 (standard primary parallel port), and 0x278 (secondary parallel port). When a valid parallel adapter is detected, the BIOS records its 16-bit I/O base address into the BIOS Data Area (BDA) starting at memory address 0040:0008h.

Four consecutive 16-bit words at this location represent LPT1 through LPT4. MS-DOS 6.22 reads these entries to determine which physical hardware ports are available and sets its logical port assignments accordingly:

  • LPT1: Mapped to the base address stored at 0040:0008h (typically 0x378 or 0x3BC).
  • LPT2: Mapped to the base address stored at 0040:000Ah (typically 0x278 or 0x378).

The MS-DOS Character Device Layer

MS-DOS 6.22 treats parallel ports as reserved character devices. The default device driver embedded inside IO.SYS registers character device names including LPT1, LPT2, LPT3, and PRN (where PRN is a default alias pointing to LPT1). Because MS-DOS treats these ports as file-like devices, software and command-line utilities can read from or write to them using standard file I/O calls without needing specialized printer drivers.

For instance, issuing command-line instructions such as DIR > LPT1 or TYPE DOCUMENT.TXT > PRN redirects text streams directly into the parallel driver routines.

Software Interrupts: INT 21h and INT 17h

Parallel communication under MS-DOS occurs through two primary layers of software interrupts:

  1. DOS Interrupt 21h (High-Level API): Applications standardizing on DOS routines use INT 21h, Function 05h (Printer Output) to send a single character to the default printer device. DOS also allows standard file functions (INT 21h, Function 40h - Write to File or Device) by passing the file handle associated with the opened LPT1 or LPT2 device.

  2. BIOS Interrupt 17h (Low-Level Control): When the MS-DOS character driver receives data for a parallel port, it generally delegates the operation to the ROM BIOS printer service via INT 17h. This interrupt provides three main functions:

    • AH = 00h (Write Character): Transmits an ASCII byte across the 8-bit data lines, checks status lines (such as BUSY and ACK), and asserts the STROBE pin.
    • AH = 01h (Initialize Port): Pulses the printer's INIT line to reset the attached device.
    • AH = 02h (Get Port Status): Queries register flags to check for conditions such as printer offline, out of paper, I/O errors, or busy states.

If a printer fails to acknowledge a transmission, the BIOS sets an error flag. MS-DOS evaluates this response and invokes the critical error handler (INT 24h), triggering the standard user prompt: "Abort, Retry, Fail?"

Port Configuration and Control with the MODE Command

MS-DOS 6.22 provides the external utility MODE.COM to alter the operational behavior of parallel ports.

  • Error and Retry Handling: Users can define how the operating system responds when a parallel device does not immediately accept data. Running MODE LPT1: RETRY=B (or P in earlier versions) directs the driver to persistently poll a busy port instead of immediately triggering a device timeout error.
  • Device Redirection: The command MODE LPT1:=COM1: instructs MS-DOS to redirect all output intended for parallel port LPT1 to serial communication port COM1. The operating system intercepts standard parallel I/O calls and routes the byte stream through the serial driver routines instead.

Beyond simple uni-directional printing, MS-DOS 6.22 supports bidirectional parallel communication using INTERLNK.EXE and INTERSVR.EXE. By utilizing specialized bidirectional parallel cables (such as LapLink cables), the InterLink driver bypasses standard INT 17h printing routines and directly manipulates the parallel port data and status registers. This allows full 4-bit (nibble-mode) or 8-bit bidirectional data transfers between two computers, enabling parallel-port networking and drive sharing directly through native DOS commands.