Saturday, August 29, 2015

Prince of Persia DOS 1.0 Sound Card Autodetection Weirdness


When Prince of Persia was originally released for DOS, alongside the Apple II version, it supported several sound cards.  The sound cards the original 1.0 version supported were Adlib, Game Blaster, Sound Blaster, Covox Sound Master.  It also supported the IBM PS/1 Audio/Joystick upgrade, the Tandy PSSJ DAC and the Tandy 3-voice PSG, and of course the PC Speaker.

For sound effects, the original version only supports either digitized sound effects or the PC Speaker sound effects.  To hear digitized sound effects, you must have a Sound Blaster, Tandy DAC, Covox Sound Master or IBM PS/1 Audio/Joystick card.  Otherwise, you will hear PC speaker sound effects.

You can hear music with any of these cards.  Music will sound identical with an Adlib or Sound Blaster or any compatible.  The music will sound similar whether played on a Tandy 3-voice PSG, the 3-voice PSG of the Covox Sound Master or the 12-voice PSG of the Game Blaster.  There is also PC Speaker music. Note that of all the music choices, only the Game Blaster will output in stereo.

The game's executable recognizes several command line parameters related to sound.  The sound card command line parameters in 1.0 are adlib, covox, gblast, ibmg, sblast, tandy & stdsnd.  All should be self explanatory.  They are intended to allow you to override the autodetect function, but do not always work as intended.


When you put a sound card inside a Tandy 1000 with a DAC, things get interesting :

Adlib MSC :
No parameter – Adlib music, Tandy DAC sound effects
Adlib – Adlib music, PC Speaker sound effects
Tandy - Adlib music, Tandy DAC sound effects
Stdsnd – PC Speaker music, PC Speaker sound effects

Game Blaster :
No parameter – Game Blaster music, PC Speaker sound effects
Gblast – Game Blaster music, PC Speaker sound effects
Tandy – Tandy music, Tandy DAC sound effects
Stdsnd – PC Speaker music, PC Speaker sound effects

No Sound Card :
No parameter - Tandy music, Tandy DAC sound effects
Tandy – Tandy music, Tandy DAC sound effects
Stdsnd – PC Speaker music, PC Speaker sound effects

I underlined the unusual options.  You cannot use the Tandy DAC with a joystick, so the Adlib parameter with the Adlib always gives you PC Speaker sound effects and restores joystick support.  However, while the game will use the Adlib with Tandy DAC if present, the same is not true with a Game Blaster in a Tandy DAC system.  You always get PC Speaker sound effects with a Game Blaster.

If you have a Tandy 1000 without a DAC, you have additional options :

No Sound Card :
No parameter – Tandy music, PC Speaker sound effects
Tandy – Tandy music, PC Speaker sound effects
Stdsnd – PC Speaker music, PC Speaker sound effects

Generic PCs behave as you would expect with sound cards, except for the following :

Sound Blaster w/CMS Upgrade :
No parameter – Adlib music (or Game Blaster music if YM-3812 is removed), Sound Blaster DAC sound effects
Sblast - Adlib music, Sound Blaster DAC sound effects
Adlib - Adlib music, PC Speaker sound effects
Gblast - Adlib music, PC Speaker sound effects (if the YM-3812 is removed from a Sound Blaster 1.0-2.0, Game Blaster music will play)
Tandy - Adlib music, PC Speaker sound effects
Stdsnd – PC Speaker music, PC Speaker sound effects


I do know that a Sound Blaster will not work reliably with a Tandy 1000 with a DAC.  Both will use DMA1 and neither device can be truly disabled.  While a Sound Blaster Pro will work in a Tandy 1000 with a DAC, you need to set it to non-standard IRQ/DMA settings to avoid freezes.  While Prince of Persia 1.0 will use IRQs other than 7, it will only use DMA1.  There were no other DMA choices available to the pre-Pro Sound Blasters other than 1.

As far as whether a Sound Blaster will work reliably in an IBM PS/1 with an Audio/Joystick card, I am uncertain.  The IBM device is mounted on a special header inside the PS/1 Model 2011 or 2121.  These machines require external adapter upgrades to support ISA cards, and they are very rare.  Both sound devices use IRQ7, but the IBM card does not use DMA.  Because Prince of Persia uses Sound Blaster IRQs like 5, it won't matter for this game but it could matter for a game like King's Quest I SCI, which only supports a Sound Blaster at IRQ7.  I think it likely that an Adlib would override the IBM music.

Although the Tandy 3-voice and IBM Audio are both based off the same PSG, IBM's card used a slightly higher base frequency than the Tandy PSG.  IBM's card will have higher pitched sound (because of a 11.7% difference in base frequencies) than the Tandy.

Finally, I am uncertain whether an Adlib card will override a Covox card for music.  Since an Adlib card always overrides a Game Blaster even if you use the gblast parameter, it is likely that it will override the Covox for music.  It is also probable that the Covox will still produce digitized sound effects like the Tandy DAC.  Covox cards are extremely rare, only recently has a user made recordings of Prince of Persia's opening with the Covox.  While the Covox has advanced musical capabilities, most companies only used the basic musical capabilities which were only slightly more advanced than the Tandy chip.  Thus the Covox sounds like a Tandy.

If you want to disable the Adlib override for the Game Blaster and Tandy 3-voice music, you have to edit the PRINCE.EXE executable.  At offset 13875h change 75h to EBh, this will make the game respect the command line parameter for sound.  This will allow you to hear Game Blaster music if an Adlib card is installed or on an upgraded Sound Blaster 2.0 or below.  The credit for this patch goes to ripsaw8080 on the VOGONS forum.


Game Blaster support is a bit buggy in version 1.0.  You can hear dropped or hanging notes in the introduction, and it gets worse as the system speed increases.  I have had nearly flawless playback in an 8MHz Tandy 1000 TX or TL.  Ripsaw8080 wrote a program that will dramatically improve note playback in faster systems, find it here : http://www.vogons.org/viewtopic.php?f=46&t=41129&hilit=prince+persia+game+blaster&start=20#p386191  Note that it requires extended keyboard BIOS functions, so it won't work properly in an IBM PC, IBM PC XT or Portable with 1st BIOS, or any Tandy 1000 before the TL and SL.  Its generally not necessary with systems that slow anyway.    The buggy Game Blaster support is probably why they removed it in version 1.3, plus it was obsolete along with the Covox Sound Master, another casualty of the version upgrade.

5 comments:

  1. FYI:

    You can get GameBlaster/CMS stereo AM Synthesis + SoundBlaster DAC via DOSBox (.74 or latest SVN) using SBType=1 (or 2) and OPLMode=CMS, without (or with) a hex-modified 1.0 prince.exe.

    Simply run the game normally without command line parameters, or, use sblast to the same effect.

    Enjoy!

    ReplyDelete
  2. You may be able to get the same effect as you describe on real hardware if you pull the Adlib chip, the YM-3812 (a.k.a. FM-1312) from your Sound Blaster 1.0-2.0.

    ReplyDelete
  3. I'm curious if it does as well, but I haven't had my 1.0/CMS upgraded 1.5 SBs in about 20 years (21 years for my GB).

    You however, with your excellent collection of hardware resources, may want to check that again...

    Speaking of GameBlaster/CMS and DOSBox, is there some reason OPLx/Your/NewRisingsSun's fixed code for greater CMS/GameBlaster tonal accuracy from almost 2 years ago isn't part of SVN?

    http://www.vogons.org/viewtopic.php?f=41&t=38350

    Perhaps I don't understand the philosophical politics of DOSBox development in regards to chip manufacturer reference specs versus board maker actual implementations and DOSBox "development" versus "patches", but it just seems like this would have been an obvious SVN include (along with other hardware accuracy fixes as of "late" - yes, I am a longtime vogons deep-lurker)...

    Not trying hijack your blog - however it did come to mind as I tested/played/experimented yet-again with DOSBox's GB/CMS emulation lately with a healthy dose of GB/CMS-based retro gaming.

    ReplyDelete
  4. I will consider testing my Sound Blaster with its Adlib chip removed, but it's all fun and games until you break off a pin.

    Improving the emulation accuracy for the various music (Tandy, Adlib and Game Blaster) chips has received no official attention in DOSBox since 0.74. This compelled me to learn how to compile DOSBox from source and add the patches to it. I believe one of the reasons why the DOSBox devs are reluctant to add patches like NRS's is because DOSBox uses some code from MAME for these modules that needs to be rewritten because MAME's license and DOSBox's license are not compatible.

    ReplyDelete
  5. Well, DOSBox-X has quite a few fixes for sound cards. The Great Codeholio has also fixed Tandy/PCjr emulation on my request. The problem was that the emulation worked at a relatively low interval. This made the technique of playing samples through the PSG sound really bad.
    He's fixed it, and it sounds crystal-clear now.

    ReplyDelete