sdl3-dos-port-pr
This is the combined work of @icculus @madebr @glebm @jayschwa @ccawley2011 and me rounding it off with stability fixes and missing features, thanks to everyone for pitching in.
This is a fairly complete port to DOS with only minor features like audio recording missing. I have tested it extensively with DevilutionX in DOSBox. But no real hardware testing. The features I didn't add is mostly because I didn't have a good way to test that they worked correctly.
For threading I took some conceptual inspiration from the PS2 port.
What's supported
- Video: VGA and VESA 1.2+ framebuffer, RGB, and 8-bit indexed color with VGA DAC palette programming, hardware page-flipping with vsync, VBE state save/restore on exit
- Audio: Sound Blaster 16 (16-bit stereo, up to 44.1 kHz), Sound Blaster Pro (8-bit stereo, up to 22 kHz), Sound Blaster 2.0/1.x (8-bit mono), all via IRQ-driven DMA with double-buffered auto-init
- Input: PS/2 keyboard with extended scancodes (0xE0 prefix), INT 33h mouse with queried sensitivity, gameport joystick via BIOS INT 15h with auto-calibration
- Threading: Cooperative scheduler using
setjmp/longjmpwith stack patching. Real mutexes, semaphores, TLS, and condition variables (generic fallback). Yield points in the event pump and delay functions keep audio and other threads responsive. - Timer: Native PIT-based timer using DJGPP's
uclock()at ~1.19 MHz resolution - Filesystem:
GetBasePath/GetPrefPathvia DJGPP'ssearchpath(), POSIX filesystem ops fallback - Build: CMake cross-compilation toolchain file, DJGPP CI job, preseed cache for faster configure
What's NOT included
- Audio recording playback only
SDL_TIMEnative implementation reuses Unixgettimeofdayvia DJGPP's POSIX layer (works fine)- Shared library loading support (no
SDL_LoadObject).
How to build
cmake -S. -Bbuild-dos \
-DCMAKE_TOOLCHAIN_FILE=build-scripts/i586-pc-msdosdjgpp.cmake \
-DCMAKE_BUILD_TYPE=Release
cmake --build build-dos -j$(nproc)