Monday, December 5, 2016

Diagonsing and Fixing DOS Games - King's Quest VI and the Sound Blaster 16

On Friday, I sat down at my 486DX2/66 computer and decided to play a little King's Quest VI: Heir Today, Gone Tommorow.  KQ6 is definitely one of Sierra's best games and it had been a long time since I last tried to play it through.  I had the floppy version installed on my hard drive, so I started up the floppy version.  Unfortunately, it took the whole weekend to track down the problem and implement a solution for it.




KQ6 begins with an animated introduction showing you how Prince Alexander of Daventry discovers the way to find the Land of the Green Isles.  The introduction begins with Prince Alexander longing to meet Princess Cassima again, whom he met when they were rescued in King's Quest V: Absence Makes the Heart Go Fonder.  He tells his mother, Queen Valanice, that he is frustrated that he cannot find any information about the Green Isles.  Valanice tells him to forget about Cassima and think of something else.  After she leaves, Alexander looks into the Magic Mirror and sees Cassima pining for him at her window.  He tells his mother that he can navigate by the stars he saw in the Mirror.  Off he sails for the Land of the Green Isles.  He finally discovers the Land of the Green Isles but his ship is wrecked in a storm.  At this point, control over Alexander is handed over to the player and the game properly begins.

In 1992, this animated introduction was pretty impressive.  It weighed in at 6MB, about 40% of the game's size was taken up just by this feature.  The dialogue is fully spoken throughout if you have a supported sound card.  KQ6 came on nine 1.44MB disks, and they had to pack a lot of material into those disks and compress it as well.

In addition to the animated introduction, KQ6 has certain in-game sound effects that use the digitized audio capabilities of the Sound Blaster.  The most obvious one is moving the plank on the beach.  If you go into the About section of the settings menu, you can hear a short digitized snippet from the sung version of "Girl in the Tower."  While an awful song, it is useful to test whether your Sound Blaster's digital audio is working properly.  If you really want to hear the whole thing, you can find it as a track on the King's Quest VI CD-ROM, which is a mixed data and audio CD.

In my computer I had installed a Sound Blaster 16 and intended to use it for digital audio and its MPU-401 "Compatible" MIDI interface to drive a Roland SC-55.  But I started encountering problems with the audio that weren't so easy to fix.  You would think that a game as popular as KQ6 and a sound card as prevalent as the SB16 should get along like Sodium and Chloride, but I had to think again.  I did discover a solution, but in this article I want to discuss the process of finding it.

The symptom started as issue where you would hear the first digital sound and then nothing.  Things I tried did not fix the problem and would result in extremely slow sound playback, sounds being cut off too early, or the sound not playing at all during the opening and preventing the opening from progressing.

The first thing when looking for solutions with DOS games and real hardware is to identify the hardware and software being used.  In this case, the software was King's Quest VI, English Floppy Disk Version 1.000.  I installed it from good floppy disk images, no pirated crap here.  The underlying Operating System was MS-DOS 6.22.

Second, we look at the hardware currently installed in the system.  When I encountered the issue, the following was installed in my system :

Intel 486DX2/66 w/16MB of RAM (2 x 8MB FPM 72-pin SIMM)
ASUS VL/I-486SV2G (SiS 85C471 + 85C407 chipset)
Gravis Ultrasound ACE 1.0
Sound Blaster 16 MCD CT-1750 DSP 4.05
Kouwell  KW-560D I/O, IDE & Floppy VLB/ISA Controller
Diamond SpeedStar 24 Tseng ET4000AX w/1MB SVGA
Epson SD-880 3.5"/5.25" Combo Floppy
NESI IDE CD-ROM 8x
2GB SanDisk Compact Flash w/Addonics CF-IDE Adapter

Drive A: is the 3.5" disk drive, Drive B: is the 5.25" disk drive, Drive C: is the Compact Flash drive and Drive D: is the CD-ROM drive.  I have the C: and D: drives connected to the VLB IDE port, but it is only configured to use ISA speed.  I distrust IDE VLB solutions, the VL Bus was fine for video cards, but for mass storage it may not be truly reliable.  The serial ports and the parallel ports were configured for their default I/O and IRQ solutions, and the parallel port was not in the ECP mode (which uses a DMA channel).

Finally, we need to consider what is being loaded with AUTOEXEC.BAT and  CONFIG.SYS.  Here are the active lines of each, respectively  :

SET ULTRASND=240,7,6,5,11
SET ULTRADIR=C:\ULTRASND
C:\ULTRASND\ULTRINIT.EXE -dj
SET PATH=C:\WINDOWS;C:\ULTRASND;C:\;C:\DOS;C:\DRIVERS;C:\SB16
SET TEMP=C:\WINDOWS\TEMP
SET SOUND=C:\SB16
SET BLASTER=A220 I7 D1 H5 P330 T6
SET MIDI=SYNTH:1 MAP:E
C:\SB16\DIAGNOSE /S
C:\SB16\MIXERSET /P /Q
LH C:\DRIVERS\CTMOUSE.EXE
LH C:\DOS\MSCDEX /D:MSCD001

DEVICE=C:\WINDOWS\HIMEM.SYS /TESTMEM:OFF
DEVICE=C:\WINDOWS\EMM386.EXE RAM 4096 I=B000-B7FF
DEVICEHIGH=C:\DRIVERS\VIDE-CDD.SYS /D:MSCD001
FILES=40
BUFFERS=20
DOS=HIGH,UMB
STACKS=9,256

Nothing particularly unusual here, and nothing I REM'ed out in these configuration files helped. 

My first suspect was the Sound Blaster 16.  Among the sound devices that King's Quest VI officially supports for digital audio is the Disney Sound Source, so I took mine off the shelf and hooked it up to my parallel port.  That device had no issues I could hear with the digital audio, everything played back fine, if in low quality.  (The DSS has an 8-bit, 7KHz mono sample rate).  This was important to also rule out the possibility of file corruption.  Next I tried my Sound Blaster 1.5, which also had no issue.  Then I tried my Sound Blaster Pro 1.0, and again, no problems there.  I knew by this point that the game had no issue with Sound Blasters in my system generally, just with a 16.  

I have an early, middle and late SB16.  The early SB16 was the card exhibiting issues.  I was curious to see how the game would behave with the CD-ROM version of the game.  I have the standalone King's Quest VI CD and the version contained on the King's Quest 15th Anniversary CD, but I only had the Anniversary CD on a physical disk.  The standalone version is also v1.000, but the one on the Anniversary CD is v1.034.  (CD2 contains the game, including the Girl in the Tower song, on a mixed data/audio CD).  It too exhibited issues, such as random freezing on CD access, but it did not have quite as many issues as the floppy version.  CD access only occurs when accessing digital audio when you do a large install of the game to a hard drive.  Given that all the speech is digital audio, CD access is still very frequent if the speech option is on.

Being puzzled with these results, I then I tried the middle SB16, the Sound Blaster 16 MCD CT-2230 DSP 4.11.   The CT-2230 did not seem to have a problem with the floppy version, but had even worse issues with the CD-ROM version.  Any access to the CD would cause it to freeze.  

Even more puzzling that King's Quest VI CD worked just fine in Windows 3,1 for both games.  Fortunately only the DOS executables had issues.  I knew that Sierra SCI games had issues with Sound Blaster detection at around my system's speed.  There is a patch program called GOSiERRA that can fix an "Unable to initialize your audio hardware" error for SCI1 and SCI1.1 games.  Each interpreter version uses a different fix, but the GOSiERRA program can determine the type of fix required.

The main SCI1 games include Quest for Glory II, King's Quest V, Leisure Suit Larry 1 VGA, Space Quest IV*, Leisure Suit Larry 5, Conquests of the Longbow,  Space Quest 1 VGA, Police Quest III, EcoQuest and  Castle of Dr. Brain.  

* - CD Version is SCI 1.1

The main SCI1.1 games include KQ6, Laura Bow: Dagger of Amon Ra, Space Quest V, Leisure Suit Larry 6, Freddy Pharkas Frontier Pharmacist, Quest for Glory I VGA, Police Quest I VGA, Quest for Glory III, EcoQuest 2 and Island of Dr. Brain.

Unfortunately, the GOSiERRA patches did not show an improvement.  Next I checked to see if there was any report on the Sierra Help Pages that would help me out.  I found that there was an updated driver for the Sound Blaster that would fix an issue in which only the first digitized sound is heard.  For SCI1.1 games, the Sound Blaster driver is called AUDBLAST.DRV.  (For SCI1 games, the Sound Blaster digital audio driver is either SNDBLAST,DRV (using the Adlib FM Synthesis OPL2/OPL3 chip for Music) or MTBLAST.DRV (using the MT-32 for music)).  

Unfortunately, the updated AUDBLAST.DRV did not fix my problem either.  More digital audio would be heard in game with the CT-1750, but it would sound cut off.  The digital audio in the opening would also cut out way too quickly.  I tried decompressing the audio files on the hard drive using the DECOMPAUD utility found in the game's directory, but it did not help.

I was about to give up hope when I read something interesting in the CD-ROM version's README file :

"Q: "The music is fine, but the voices hesitate or skip.  What can I
do?"
A: Increase the audio buffer size for smoother speech.  First, make 
sure you're using a boot disk to free up plenty of memory.  Edit the 
RESOURCE.CFG file in the C:\SIERRA\KQ6CD> directory.  The default is 
"AudioSize = 8K".  Increase the size to "24K" for smoother speech with
more free memory.  Note that this is for KQ6 running under DOS (rather than Windows.)"

When I tried changing this parameter for the floppy disk version, after having installed the updated AUDBLAST.DRV, the voices and digital audio finally sounded correct and would repeat correctly.  The opening movie's voices and the in game sound effects now sounded correctly with the CT-1750. This solution also worked for the CD-ROM version, so I had completely fixed the game for the CT-1750.

However, using the updated driver with the CT-2230 did not work, the game would freeze randomly in the CD-ROM version even with AudioSize = 24K designated in the RESORUCE.CFG.  I knew that the CT-2230 worked just fine with the floppy disk version without any adjustments to the AUDBLAST.DRV file.  I wondered if the audio would work if I copied the floppy version's AUDBLAST.DRV file into the CD-ROM's directory.  Well, I tried it and my crashing issues went away.  I increased the AudioSize to 16K, but I am not sure if it is necessary. The voices in the opening and the voices and sound effects in-game now worked perfectly without crashes, slowdowns, skips or silences.

Here are the known English versions of KQ6 and the date and size of the AUDBLAST.DRV file which comes with them :

King’s Quest VI, Version 1.000 
AUDBLAST.DRV 09/10/1992, 5,871 Bytes

King’s Quest VI CD, Version 1.000
AUDBLAST.DRV 04/26/1993, 7,670 Bytes

King’s Quest VI CD, Version 1.034
AUDBLAST.DRV 07/16/1993, 8,749 Bytes

In summary

for KQ6 floppy or CD and you have a Sound Blaster 16 with a DSP of 4.05 or lower, use :
AUDBLAST.DRV 07/16/1993, 8,749 Bytes and AudioSize = 24K

for KQ6 floppy or CD and you have a Sound Blaster 16 with a DSP of 4.11 or higher, use :
AUDBLAST.DRV 09/10/1992, 5,871 Bytes [and AudioSize = 16K], or
AUDBLAST.DRV 04/26/1993, 7,670 Bytes.  No change to the AudioSize is needed for this driver.

The solution seems rather counter intuitive.  The CT-1750 came out before the CT-2230, but the later driver works with it and vice versa. The AUDBLAST.DRV 04/26/1993, 7,670 Bytes behaves similarly to the AUDBLAST.DRV 09/10/1992, 5,871 Bytes because the updated SB16 driver which was originally provided by Sierra is identical to the one found on the KQ6 CD v1.034.

I believe that the issue is likely dictated by the version of the DSP than anything else on the SB16.  SB16 DSPs come in 4.01, 4.04, 4.05, 4.11, 4.12, 4.13 and maybe 4.16.  4.01-4.05 represents the earlier DSPs and DSPs 4.11-4.13 represent a later class of DSP.  

This solution may for work if similar problems are encountered in other SCI1.1 games.  It may not even be an issue in another system, given the quirkiness of my 486's motherboard.  

The ultimate combo for King's Quest VI and most late Sierra games is a Sound Blaster 16, Windows Sound System or Pro Audio Spectrum 16 for digital audio and speech and a Roland Sound Canvas for music.  However, when I connected my SC-55 to the SB16 using a gameport/midi cable, the digital audio playback was vvvveeeerrrryyyy sssslllloooowwww.  Originally I figured that the DSP was not able to keep up with the dual tasks of digitized audio and MIDI data output.  I switched the MIDI port on the SB16 to I/O 300 and installed my Roland MPU-401 interface.  When the MPU-401 occupies I/O 330, it will handle the MIDI data output duties.  With it installed, the digital audio played back at the proper speed.

My friend Cloudschatze suggested another solution for the MIDI issue after reading this blog entry.  He suggested using SBMPU401.EXE with the /E flag.  With the old SB16 with the 4.05 DSP, that fixed the slow digital playback issue.  It was not necessary with the  middle SB16 with the 4.11 DSP.  SBMPU401.EXE is a Creative program that can be found in the SB16 driver package and fixes a spurious interrupt issue with the SB16's MPU-401 interface that can cause issues in some games.

3 comments:

Trixter said...

Usually, "plays a sound then stops” is a conflicting IRQ setting. I'm surprised that wasn't the case here.

Great Hierophant said...

Thanks for pointing that out, that was one of the first things I thought but I had checked and rechecked the settings of my card and it was working properly with other games.

Anonymous said...

I was a bit puzzled that your AUTOEXEC.BAT doesn't load SMARTDRV.EXE. Any particular reason for that?