First post, by dvwjr
This is for Ace from posts from the VOGONs OPL3 output problem of the Sound Blaster Pro2 (and clones) on 'faster' CPUs on DOS thread.
Star Wars X-Wing (1993 floppy version) Sound Blaster driver configuration
Problem:
On real x86 ISA based hardware the X-Wing (floppy version) sound card driver file: ADLIB_W.IMS has timer and delay problems which cause OPL FM output problems Sound Blaster sound cards which are operated on systems which are faster than the 1993 era 80386 CPUs which supported ISA bus based Sound Blaster hardware.
Background:
The Star Wars X-Wing (floppy version) released in 1993 functioned properly on 80386/80486 CPUs of the day with Sound Blaster ISA sound cards since the CPU register based timing delays functioned properly with then current CPUs. The problematic DOS sound driver for the Sound Blaster family of sound cards, ADLIB_W.IMS was a combination of the Creative CT-VOICE.DRV code and some LucasArts integration and modification to enable SoundBlaster support in X-Wing. The IMS 'driver' was actually created as a loadable MS-DOS EXE format file. The LucasArts programmers used some of their own code to support faster CPUs in the future, however their routine for creating timing delays for accessing the Sound Blaster OPL FM registers and data I/O ports was poorly coded and then never even used.
However, the problems with the LucasArts delay algorithm never mattered since the Sound Blaster port I/O delay values created were never actually used in their ADLIB_W.IMS driver code. The ADLIB_W.IMS driver for the Sound Blasters actually ignores the Sound Blaster port I/O delays and just uses the default AdLIB code for FM register and data I/O ports located at the default 0x388 and 0x389 addresses - with insufficient delays created via CPU register decrementing. Since the faster the CPU, the lower the delay time, hence the problems with the Sound Blaster sound cards on faster CPUs. This problem is not seen on emulators such as DOSBox, since the emulated Sound Blaster does not share all of the hardware timing limitations of actual Sound Blaster ISA sound card hardware.
Program configuration:
The X-Wing INSTALL.EXE program is also used to setup the supported sound card configuration via the "Set Sound Board Configuration" option by modifying the LANDRU.CFG file located in the home \XWING sub-directory. The first entry is the name of the LucasArts IMS sound card driver file to be used by the XWING.EXE game.
LANDRU.CFG
==========
adlib_w
FAST
ems
diff
==========
The following table indicates the relationship between the Sound Card choices and the LucasArts IMS driver file used:
Selection Driver file
========================================================
1.) No Sound nosound
2.) AdLib and compatibles adlib
3.) Roland roland
4.) General MIDI (GMIDI) gmidi
5.) SoundBlaster adlib_w
6.) SoundBlaster Pro and compatibles adlib_w
7.) Roland with SoundBlaster roland_w
8.) General MIDI with SoundBlaster gmidi_w
All Sound Blaster ISA sound cards will use the ADLIB_W.IMS driver file.
Solution:
The default ADLIB_W.IMS driver file was modified to correct numerous timing error present in the LucasArts IMS driver code. A total of 206 of the 26,096 bytes in the driver file were modified to allow proper functionality of the modified driver on systems ranging from a DOS 6.22 Dell GXi 200MHz Pentium system with an ISA Sound Blaster Pro 2 (CT-1600) to an Intel 440BX based system with an Intel 1400Mhz Celeron SL6C6 (Tualatin) CPU with an ISA Sound Blaster AWE64 Gold (CT-4540) running directly under Win98SE and the 'native' DOS 7.1 from Win98SE.
Even with the modified ADLIB_W.IMS driver for the Sound Blaster, Sound Blaster Pro and the Sound Blaster 16, to allow the OPL FM and digital sound effects to function properly with this 1993 floppy diskette release of the Star Wars X-Wing game, the PC used must have one megabyte of EMS memory available. Lack of sufficient EMS memory will cause either no sound or distorted sound even with the modified ADLIB_W.IMS driver.
This modified ADLIB_W.IMS driver is delivered as the new driver file SBPRO_W.IMS, which is a replacement for the defective ADLIB_W.IMS driver. Delete the current ADLIB_W.IMS file and rename the SBPRO_W.IMS to ADLIB_W.IMS in the \XWING game sub-directory.
The modified SBPRO_W.IMS driver file has one potential patch byte for changing the new default delay for ISA based Sound Blaster sound cards. The default delay byte value is 0x07 which should allow more than enough delay time for proper access to the ISA Sound Blaster hardware OPL FM I/O ports. This byte is documented in the XWING_SBPRO_FIX.TXT file included in the latest attached XWING_SBPRO_FIX.ZIP file.
Ace,
If you get a chance to download and test this new replacement Star Wars X-Wing IMS driver, please be sure to test with only one Sound Blaster Pro (or clone) sound card present on the ISA bus. Dual cards, even if 'disabled' can still have an impact. Single card Sound Blaster, Sound Blaster Pro (or clone) or 16 SB16+ card testing would be appreciated. Hope this works out for you and your desire to hear OPL2 FM music and digital sound effects on real OPL hardware for this particular DOS game.
Thanks to the DOSBox team for the DOSBox 'heavy' debugger. 😁
dvwjr
Edited: 05/17/2011 - Updated with newer modified IMS driver file in a new ZIP file, changed some text to reflect update and change of original re-directed VOGONs message thread.
If you downloaded the original SBPRO_W.IMS driver, please downoad the latest SBPRO_W.IMS driver file in the XWing_SBpro_fix.zip file.
Edited: 05/27/2011 - Fixed references from XWING_FIX.ZIP to XWING_SBPRO_FIX.ZIP for attachments.