11-23-2024, 01:20 PM
(This post was last modified: 11-24-2024, 11:37 AM by jofers.
Edit Reason: Adding more game links
)
You might need to be a certain age to appreciate this, but I made a "driver" for emulating old QB games that use DS4QB2 for sound in the V86 PC emulator. Behold, no one has heard these sounds in 20 years!
Some tests: Some that almost work but not quite
Long story:
DS4QB was a family of audio libraries for QB. Instead of using a sound blaster driver, they used an I/O port to signal a Win32 host application that played sounds using LibBASS. This ended up being a cursed solution - when Windows XP rolled around with its Hardware Abstraction Layer, both DOS and Win32 applications lost direct access to I/O and the games stopped working. And since it used this hacky mechanism, DOS emulators never supported it, unless you make a VM and install Windows 9x on it.
How I got this working:
V86 is a lovely, very hackable javascript X86 emulator. So I wanted to see if I could run DOS in the emulator and talk to games using one of the DS4QB protocol, but from Javascript code. I picked DS4QB2 because it had a lot of games using it, and it's easier to emulate than the original.
DS4QB2 communicated with its host (a Visual Basic program) like this:
V86 has an API to read I/O ports, so I polled it every 50ms and did a little dance when I saw port 0 flip from 0 to 3 ("Load SFX").
But V86 doesn't have any APIs to share files with DOS guests. Luckily though, If you put the contents of your FAT image into an ArrayBuffer and provide that instead of a URL to V86 for the hard disk, it will read and write blocks directly to that ArrayBuffer. So, using a FAT library I ported to webassembly, I mounted, read DS4QB2.DAT, and unmounted the ArrayBuffer right after the port when high.
With the decoded signal and parameters, I used howler.js to play sounds and MP3s. MOD/IT/S3M/XM don't have browser support, so I used a library called chiptune3.js to play those.
I also added a few other nice-to-haves:
What's Left:
DS4QB++ shouldn't be too bad to support since it had a Win9X mode that worked similarly to DS4QB2
The original DS4QB, however, used a clipboard interrupt that Windows 3.1 and 9x added for transferring parameters. Supporting this will require writing a TSR to mimic the original interrupts and write memory addresses to I/O ports instead of whatever black magic Windows used to access the clipboard.
I need to package the source code and make it available. In the meantime, if anyone has any old hard drives with forgotten DS4QB2 games, let me know!
Some tests: Some that almost work but not quite
- Super Sumo Wrestling - gets to the menu screen and plays music, but hangs
- Zeta (B2) - (game from the library author. Gets to the production logo and hangs before playing anything)
Long story:
DS4QB was a family of audio libraries for QB. Instead of using a sound blaster driver, they used an I/O port to signal a Win32 host application that played sounds using LibBASS. This ended up being a cursed solution - when Windows XP rolled around with its Hardware Abstraction Layer, both DOS and Win32 applications lost direct access to I/O and the games stopped working. And since it used this hacky mechanism, DOS emulators never supported it, unless you make a VM and install Windows 9x on it.
How I got this working:
V86 is a lovely, very hackable javascript X86 emulator. So I wanted to see if I could run DOS in the emulator and talk to games using one of the DS4QB protocol, but from Javascript code. I picked DS4QB2 because it had a lot of games using it, and it's easier to emulate than the original.
DS4QB2 communicated with its host (a Visual Basic program) like this:
- Client writes parameters to a file called DS4QB2.DAT
- Client sets I/O port 0 (DMA) to a value to indicate the function
- Host polls port 0 and responds when the value is non-zero
- Host reads parameters from DS4QB2.DAT and calls an audio function
- Host clears port 0
- Guest polls port 0 and resume executing
V86 has an API to read I/O ports, so I polled it every 50ms and did a little dance when I saw port 0 flip from 0 to 3 ("Load SFX").
But V86 doesn't have any APIs to share files with DOS guests. Luckily though, If you put the contents of your FAT image into an ArrayBuffer and provide that instead of a URL to V86 for the hard disk, it will read and write blocks directly to that ArrayBuffer. So, using a FAT library I ported to webassembly, I mounted, read DS4QB2.DAT, and unmounted the ArrayBuffer right after the port when high.
With the decoded signal and parameters, I used howler.js to play sounds and MP3s. MOD/IT/S3M/XM don't have browser support, so I used a library called chiptune3.js to play those.
I also added a few other nice-to-haves:
- Automatically extract ZIP files into a FAT image
- Code to open AUTOEXEC.BAT and add a game's EXE, the mouse driver, or EMS Magic.
What's Left:
DS4QB++ shouldn't be too bad to support since it had a Win9X mode that worked similarly to DS4QB2
The original DS4QB, however, used a clipboard interrupt that Windows 3.1 and 9x added for transferring parameters. Supporting this will require writing a TSR to mimic the original interrupts and write memory addresses to I/O ports instead of whatever black magic Windows used to access the clipboard.
I need to package the source code and make it available. In the meantime, if anyone has any old hard drives with forgotten DS4QB2 games, let me know!