Configuring Serial Ports in MS‑DOS via CONFIG.SYS: A Practical Guide
Learn how to load a serial‑port driver at boot using CONFIG.SYS, verify it, and understand the trade‑offs. A step‑by‑step example shows the exact lines you need to add and how to confirm the driver is active.
20 Jul 2025, 17:46 UTC

Problem: Getting a Serial Port to Work in a Legacy MS‑DOS System
\nWhen maintaining or upgrading an old MS‑DOS machine, you often need a working serial port (COM1:, COM2:, etc.). Unlike modern operating systems, DOS does not auto‑detect hardware; you must explicitly load a driver that tells the kernel how to communicate with the port. The driver must be loaded before any program that wants to use the device runs, and the only place to do that is in CONFIG.SYS. Mis‑configuring this file can brick the system, so a clear, step‑by‑step approach is essential.
Thesis: CONFIG.SYS is the single, reliable place to register device drivers at boot time, and by following a simple pattern you can make any serial‑port driver available to all DOS applications.
\n\n1. Why CONFIG.SYS Matters
\nWhen DOS boots, it first reads the boot sector, then parses CONFIG.SYS, and only after that does it execute AUTOEXEC.BAT. The DEVICE= directive in CONFIG.SYS tells DOS to load a binary driver and register it with the kernel. The driver file must be on a drive that DOS can access early in the boot process – typically the same drive that contains the boot sector (often the C: drive).
Because CONFIG.SYS is parsed before any programs run, any syntax error or missing file will halt the boot sequence. That is why the file must be edited with care: a stray space, wrong path, or missing extension will prevent the system from starting.
2. Adding a Serial‑Port Driver
\nSuppose you have a COMPAQ serial driver named COMDRVR.SYS that supports a standard 16550 UART. Follow these steps:
- \n
- Place the driver on the boot drive. Copy
COMDRVR.SYSto the root of the C: drive (or the drive that contains the boot sector). The file must be readable at load time.\n\n - Edit CONFIG.SYS. Open
C:\\CONFIG.SYSwith a text editor such asEDITorNOTEPAD.\n\n - Add the DEVICE line. Append or insert the following line, making sure there are no leading or trailing spaces:\n\n
\n\nDEVICE=C:\\COMDRVR.SYS\n - Save and close. Ensure the file is saved in DOS‑compatible line endings (CRLF). Do not add any other directives that might conflict.\n \n
After rebooting, DOS will load COMDRVR.SYS, which will register the COM1 device with the kernel. The driver will typically expose the device as COM1: and set up the appropriate interrupt vector (INT 14h for serial I/O).
3. Verifying the Driver is Active
\nThere are several ways to confirm the driver has been loaded successfully:
\n- \n
- MODE command. Run
MODE COM1:9600,N,8,1. If the command returns \"COM1: is ready\", the driver is active.\n\n - Batch script test. Create a small batch file,
TESTCOM.BAT:\n\n
\n\nRunning@echo off\nsetlocal\nrem Attempt to write a byte to COM1\ncopy /b NUL COM1: > nul 2>&1\nif errorlevel 1 (\n echo Driver not loaded\n) else (\n echo Driver is ready\n)\nendlocal\nTESTCOMshould echo \"Driver is ready\" if the driver is present.\n\n - Interrupt vector check. A tiny assembly program can read the INT 14h vector address. If the vector points to the driver’s entry point, the driver is correctly registered.\n \n
Any of these methods will give you a quick, reliable indication that the driver is functioning.
\n\n4. Trade‑offs and Limitations
\n- \n
- Driver compatibility. Drivers compiled for DOS 6.x may use newer API calls (e.g., the 16‑bit Protected‑Mode interface) that are not available in DOS 5.x or earlier. If you boot into an older DOS release, the driver may fail to load or crash the system.\n\n
- Load order matters. If multiple drivers expose the same device name (e.g., two COM port drivers), the one listed last in
CONFIG.SYSwill override earlier ones. Plan the order carefully.\n\n - Boot drive dependency. The driver file must reside on a drive that is accessible before the kernel initializes the device. If you move the driver to a different drive (e.g., D:), you must also add a
DEVICE=C:\\DRIVERS\\COMDRVR.SYSline and ensure the boot drive has a path to that location, which is often not possible.\n\n - Risk of boot failure. A typo in
CONFIG.SYScan prevent DOS from booting. Keep a backup of the original file and test changes on a non‑critical system first.\n \n
Actionable Closing
\nBy placing the driver in the boot drive, adding a precise DEVICE= line to CONFIG.SYS, and verifying with MODE or a simple batch test, you can reliably expose a serial port to all DOS programs. Remember to consider driver compatibility, load order, and the risk of boot failures. With this approach, legacy systems can continue to communicate over serial ports without needing a full OS upgrade.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.