Emulating DS4QB2 - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1) +--- Forum: QBJS, BAM, and Other BASICs (https://qb64phoenix.com/forum/forumdisplay.php?fid=50) +--- Thread: Emulating DS4QB2 (/showthread.php?tid=3227) |
Emulating DS4QB2 - jofers - 11-23-2024 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! RE: Emulating DS4QB2 - Dav - 11-23-2024 Hi @jofers! Now there’s a name I know from the QB glory days. Really good to see you’re still around. I recall that project, and it’s possible I saved some of those games on a hard drive somewhere. Plasma is still around, perhaps he may have them somewhere. I’ll dig through my QB code hard drives…. - Dav RE: Emulating DS4QB2 - bplus - 11-23-2024 Wow! @jofers Is is a third way to run QB64 code over the browser? (I am thinking BAM and QBJS as 2, maybe there was another through ports?) Welcome RE: Emulating DS4QB2 - jofers - 11-24-2024 @Dav - I knew I'd find some familiar faces here! How have you been? @bplus - I wish it were, but this project is merely to emulate audio for DOS EXEs made with the original QuickBASIC and a specific audio library. DOS emulators that run QBasic have been around for awhile though! RE: Emulating DS4QB2 - Pete - 11-24-2024 I remember you from the QBasic Forum. Wow, you're still living in the past. Next trip back, take me with you!!!! Pete - Wondering if fallen angles also have that Democrat mantra. "We won't go back!"? |