Windows 98 DOS Graphics Memory Management
Microsoft Windows 98 managed memory allocation for DOS graphics modes through CPU virtualization, specialized 32-bit Virtual Device Drivers (VxDs), and adaptive video buffering. By utilizing the x86 processor's Virtual 8086 (V86) mode, the operating system isolated DOS programs inside dedicated Virtual DOS Machines (VDMs). Within this architecture, memory managers—primarily the Virtual Display Driver (VDD) and the Virtual Flat Framebuffer Driver (VFlatD)—arbitrated access to standard video memory addresses, deciding whether to virtualize the memory in system RAM or grant direct hardware access depending on whether the program ran in a window or full screen.
The Virtual 8086 Environment and Memory Mapping
Under DOS, graphics programs expected direct access to physical
memory. Standard VGA graphics reserved a 128 KB block of memory between
hexadecimal addresses A0000 and BFFFF (the
upper memory area) to serve as the video frame buffer:
A0000toAFFFF(64 KB): Standard EGA/VGA graphics modes (such as Mode 13h).B0000toB7FFF(32 KB): Monochrome text and graphics (Hercules).B8000toBFFFF(32 KB): Color text and CGA graphics modes.
Windows 98 used the x86 paging unit to control this address range.
Inside each VDM, the operating system mapped these 16-bit conventional
addresses to physical RAM pages under the supervision of the Virtual
Machine Manager (VMM32). When a DOS application attempted to read from
or write to the A0000h range, the underlying memory
subsystem intercepted or redirected the operations based on the active
execution context.
The Virtual Display Driver (VDD)
The Virtual Display Driver (*VDD) was the core component
handling graphics memory allocation. VDD monitored the state of the DOS
application by trapping input/output (I/O) port operations directed at
the VGA controller (ports 03C0h through
03DFh).
When an application initiated an INT 10h BIOS call to switch into a graphics mode, the VDD detected the change and adjusted the application’s memory allocation accordingly. If multiple DOS programs were running simultaneously, VDD ensured that each process maintained its own private, virtualized view of the video RAM without corrupting other processes or the Windows desktop.
Windowed Mode vs. Full-Screen Mode
Memory handling differed significantly depending on how the DOS application was displayed:
1. Windowed Execution
When a DOS graphics application ran inside a desktop window, it was barred from touching physical video RAM. Instead, Windows 98 allocated a "shadow buffer" in system RAM that mirrored the expected video hardware:
- Emulated Framebuffer: The VDD backed the
A0000–BFFFFaddress space with standard system memory pages. - Dirty Page Tracking: Windows used the CPU's page-fault mechanisms to monitor which pages in the shadow buffer were modified by the application.
- Blitting: At regular refresh intervals, the Windows Graphics Device Interface (GDI) or DirectDraw read the modified pages from the shadow buffer, converted the raw palette and pixel data into a 32-bit Windows bitmap format, and rendered (blitted) it onto the desktop surface.
2. Full-Screen Execution
When a user switched a DOS application to full screen (via Alt+Enter), Windows 98 prioritized performance over isolation:
- Hardware Handover: The Windows desktop was suspended, and the physical display adapter’s video memory was mapped directly into the VDM’s address space.
- Direct Framebuffer Access: The application wrote
directly to the physical
A0000hvideo memory, bypassing translation layers and maximizing frame rates. - State Preservation: If the user toggled back to the desktop, VDD rapidly copied the current state of the physical video hardware into an off-screen buffer in system RAM, restored the Windows desktop framebuffer, and switched back to virtualized shadow buffers.
High-Resolution VESA Modes and VFlatD
Super VGA (SVGA) and VESA BIOS Extensions (VBE) required more than
the standard 64 KB memory window at A0000h. These
higher-resolution modes required large amounts of video memory managed
through either bank switching or a Linear Frame Buffer (LFB).
Windows 98 utilized the Virtual Flat Framebuffer Driver
(VFLATD.386) to manage this expanded memory:
- Bank Switching Virtualization: Standard DOS games
used 64 KB pages swapped into the
A0000hsegment via hardware bank registers. VFlatD trapped the banking calls and translated them to the correct offset in modern, multi-megabyte video cards. - Linear Frame Buffers: For VESA 2.0-compliant applications, VFlatD mapped a continuous 32-bit virtual address block directly to physical video RAM, enabling DOS applications to treat multi-megabyte video memory as a single contiguous array without manual page swapping.
Real-Mode Fallback (MS-DOS Mode)
For legacy DOS graphics software with complex custom memory managers, non-standard VGA tweaks (such as "Mode X"), or timing-sensitive memory access, Windows 98 provided "MS-DOS Mode."
Rather than virtualizing memory through VxDs, Windows 98 unloaded the
GUI, unloaded protected-mode drivers, and rebooted into a pure 16-bit
real-mode environment. This removed the operating system's memory
abstraction entirely, giving the DOS application unimpeded, native
control over conventional memory, extended memory (via
HIMEM.SYS), expanded memory (via EMM386.EXE),
and physical video memory.