MS-DOS 6.22 Sound Card IRQ Environment Variables

MS-DOS 6.22 does not manage hardware interrupts at the kernel level; instead, it uses global environment variables defined in configuration files to communicate hardware assignments to software. Because MS-DOS operates in real mode without a unified hardware abstraction layer, applications must directly query environment variables—most notably the BLASTER variable—to discover which Interrupt Request (IRQ) line the sound card is configured to use. This system relies on strict synchronization between the environment string, initialization drivers, and the physical configuration of the hardware.

The BLASTER Environment Variable

The primary mechanism for sound card configuration in MS-DOS 6.22 is the SET BLASTER command, traditionally placed in the AUTOEXEC.BAT startup file. A typical configuration entry appears as follows:

SET BLASTER=A220 I5 D1 H5 P330 T6

In this string, each letter denotes a hardware resource parameter:

  • A (Base I/O Port): Typically 220 (hexadecimal), defining where communication begins.
  • I (Interrupt Request): Represents the IRQ channel assigned to the card, such as I5 (IRQ 5) or I7 (IRQ 7).
  • D (8-bit DMA Channel): Commonly D1 for low-channel direct memory access.
  • H (16-bit DMA Channel): Commonly H5 for High-DMA transfers on 16-bit cards.
  • P (MIDI Port): Typically P330 for the MPU-401 interface.
  • T (Card Type): Identifies the Sound Blaster hardware model (e.g., T6 for Sound Blaster 16).

The I parameter is essential for digitized audio playback. When audio buffers fill or drain, the sound card signals the Programmable Interrupt Controller (PIC) using the designated IRQ line.

How Applications Read the IRQ

When an MS-DOS application or game launches, it copies the parent environment block through its Program Segment Prefix (PSP). To determine the sound card’s IRQ:

  1. Environment Parsing: The program searches memory for the string BLASTER=.
  2. Parameter Extraction: It scans the string for the I flag and parses the trailing integer (e.g., 5).
  3. Interrupt Vector Mapping: The software maps the hardware IRQ to the corresponding CPU interrupt vector. On the IBM PC architecture:
    • IRQ 5 maps to Interrupt 0Dh (via the Master PIC, ports 20h/21h).
    • IRQ 7 maps to Interrupt 0Fh.
  4. Hooking the ISR: The application installs its custom Interrupt Service Routine (ISR) onto that vector using DOS Interrupt 21h, Function 25h (Set Interrupt Vector), allowing it to handle sound events directly.

Non-PnP vs. ISA Plug and Play Cards

The BLASTER variable does not configure the hardware itself on legacy cards; it merely advertises existing hardware settings to programs.

  • Legacy Non-PnP Cards: Hardware resources were physically hardwired using jumper pins or DIP switches on the ISA card. If the physical jumpers were set to IRQ 7, but AUTOEXEC.BAT specified I5, applications would attempt to listen on the wrong interrupt vector, causing audio lockups or system crashes.
  • ISA Plug and Play (PnP) Cards: Later sound cards (such as the Sound Blaster 16 PnP or AWE64) required software initialization during boot. In MS-DOS 6.22, utilities like the Creative Technology Configuration Manager (CTCM.EXE) executed via CONFIG.SYS or AUTOEXEC.BAT. The initialization manager queried the ISA PnP card, assigned an open IRQ based on system availability, and programmatically set or updated the BLASTER environment variable to match the allocated hardware state.