SDL Now Supports DOS

SDL 3 has officially added support for DOS, featuring VESA graphics, Sound Blaster audio, and significant performance optimizations for legacy systems.
SDL 3 Revives DOS with Major Update
In an impressive effort to maintain compatibility with legacy systems, the Simple DirectMedia Layer (SDL) library—the backbone of thousands of games and multimedia applications—has officially added support for DOS in SDL 3. This is the result of dedicated contributions from the open-source community, bringing modern technology back to legendary hardware platforms.
Audio Optimization and Interrupt Handling
One of the most significant improvements in this update is the restructuring of the audio system. Developers have successfully resolved Sound Blaster issues on emulators like DOSBox-X. Instead of running audio directly from the interrupt handler, SDL 3 now moves audio mixing out of the IRQ handler and into the main loop.
This change not only improves stability but also avoids reentrancy issues. The system now fully supports Sound Blaster 16 (16-bit stereo, up to 44.1 kHz) and Sound Blaster Pro (8-bit stereo, up to 22 kHz). Additionally, old tricks from the SDL 1.2 era for MacOS Classic have been applied to manage audio locks effectively during hardware interrupts.
VESA Graphics and Display Capabilities
On the visual front, SDL 3 utilizes VESA interfaces to manage displays, working seamlessly with the software renderer. Key graphics features include:
- VBE 1.2+ Support: Implementation of banked framebuffer access for modes without LFB (Linear Frame Buffer).
- Double-buffering: Support for hardware page-flipping in VBE modes with more than one image page, minimizing screen tearing.
- Color Management: Support for 8-bit indexed color modes with VGA DAC palette programming and RGB modes.
- Vsync: Automatic synchronization when blitting in single-buffered modes to ensure smooth visuals.
System Improvements and Compatibility
This port uses the DJGPP compiler and is compatible with DPMI memory management. Developers have also refined DOS keyboard handling, supporting extended scancodes and the Pause key. For controllers, joystick axis polling is throttled to ~60 Hz to reduce BIOS timing loop overhead, while buttons remain highly responsive.
A crucial technical detail is the locking of ISR (Interrupt Service Routine) code and data to prevent page faults during interrupts—a vital factor for stability in the DOS environment.
Community Effort
This project is the collaborative result of several prominent community members, including @icculus, @AJenbo, @madebr, @glebm, @jayschwa, and @ccawley2011. While minor features like audio recording are still missing, this port has been extensively tested with projects like DevilutionX in DOSBox and demonstrates remarkable stability.
SDL 3's support for DOS is more than just a technical update; it is a testament to the enduring legacy of classic computing platforms in the modern era.
Source: Hacker News















