How the MS-DOS 6.22 VER Command Detects OS Release

The MS-DOS 6.22 VER command identifies the operating system release by executing low-level software interrupts that query the running DOS kernel for version numbers, revision flags, and OEM signatures. Rather than scanning files on the disk, COMMAND.COM calls DOS API functions—primarily Interrupt 21h, Function 30h and Function 3306h—to retrieve the exact kernel version currently loaded into memory and formats that data into the readable version string displayed on the screen.

Internal Command Architecture

The VER command is an internal command integrated directly into COMMAND.COM, the standard MS-DOS command processor. Because it is embedded in memory when the shell loads, it does not rely on an external executable like CHKDSK.EXE or FORMAT.COM. When a user types VER, COMMAND.COM immediately branches to an internal routine designed to query the operating system kernel (MSDOS.SYS).

Interrupt 21h, Function 30h: Get DOS Version

The primary mechanism MS-DOS uses to identify itself is software interrupt 21h, specifically service AH = 30h ("Get DOS Version").

When COMMAND.COM invokes this interrupt:

  • AL register: Returns the major version number (for MS-DOS 6.22, this returns 06h).
  • AH register: Returns the minor version number (for MS-DOS 6.22, this returns 16h, which is decimal 22).
  • BH register: Returns the OEM (Original Equipment Manufacturer) identification number (00h represents IBM, while FFh typically represents standard Microsoft releases).
  • BL:CX registers: Return the 24-bit user serial number (often left unpopulated or set to zero in retail distributions).

Interrupt 21h, Function 3306h: Get True DOS Version

Starting with MS-DOS 5.0 and continuing through 6.22, Microsoft introduced SETVER.EXE, a device driver that tricks legacy programs into believing a different DOS version is active. If an application relied solely on INT 21h, AH = 30h, a custom SETVER entry could cause incorrect reporting.

To bypass SETVER tables and determine the real operating system release, MS-DOS 6.22 utilizes INT 21h, AX = 3306h ("Get True DOS Version"):

  • BL register: Returns the true major version (06h).
  • BH register: Returns the true minor version (16h).
  • DL register: Returns the revision number of the operating system build.
  • DH register: Returns status flags detailing whether DOS is running in ROM or loaded in the High Memory Area (HMA).

The Undocumented /R Switch

MS-DOS 6.22 includes an undocumented switch, VER /R, which exposes the data returned by AX = 3306h. When executed with this flag, the command outputs the standard version string along with the revision number (typically revision A or 00) and the memory location of the kernel, explicitly verifying whether MS-DOS is running in conventional memory or the HMA.

String Generation and Display

Once COMMAND.COM collects the register values from the kernel interrupt, it matches the OEM identifier and numerical values against its internal message table. It converts the hex byte values into decimal characters, prefixes them with the localized operating system name (e.g., "MS-DOS"), and writes the final string—MS-DOS Version 6.22—to the standard output handle.