VOGONS


First post, by noop

User metadata
Rank Member
Rank
Member

Hello, I developed a small utility to help owners of CMI8x38-based cards to run DOS software.
Based on the information from this thread: I've got the OPL3 synth from a CMI8738 working in Windows 7 x64
You specify PCI base port of the card and it redirects standard 220h, 388h, 330h port accesses to their proper locations relative to that base port.

It uses the same method that is used by SoftMPU & ADLiPT, but is written from scratch in assembly. Same requirements, needs EMM386 3.46+ running.
It remaps hardcoded port ranges and doesn't pass the data through to whatever may live on those ports. This may be later improved in the future, or made configurable.

Thanks to pdw for opensourcing his projects and to Kamerat for coming up with the idea and testing with plenty of DOS software.

Current version is 1.11
Redirects SB, Adlib, MPU401 port ranges, but digital audio support is not yet confirmed. Relative to unreleased 1.1 only has internal code refactorings and text changes. AdLib ports are redirected to SB OPL3 base port, seem to work ok.

Attachments

  • Filename
    RECMI111.ZIP
    File size
    1.04 KiB
    Downloads
    624 downloads
    File license
    Fair use/fair dealing exception
Last edited by noop on 2018-03-08, 02:21. Edited 4 times in total.

Reply 1 of 42, by Kamerat

User metadata
Rank Oldbie
Rank
Oldbie

Thanks again noop!
This is very useful for accsessing the card when it's behind a PCI-PCIe bridge or used in a virtual machine where you can't accsess the legacy ports directly. In my initial testing I found it to be very compatible when using FM synth or MPU401.

DOS Sound Blaster compatibility: PCI sound cards vs. PCI chipsets
YouTube channel

Reply 2 of 42, by Scali

User metadata
Rank l33t
Rank
l33t
noop wrote:

AdLib ports are redirected to SB OPL3 base port, seem to work ok.

Yes, that is fine.
OPL3 has two sets of registers, so it more or less looks like a dual OPL2 setup.
The first set of registers is also the OPL2-compatible set. SB Pro 2 mapped the OPL3's register sets to base-address and base-address + 2.
It also mirrored the first register set at 388h for AdLib-compatibility.

I believe the earlier SB Pro, with dual OPL2, actually made writes to 388h go to both OPL2 chips at the same time. The first OPL2 chip is at base-address, and the second is at base-address + 2.
So in that case, it will be different... but those cards are not your target anyway.

http://scalibq.wordpress.com/just-keeping-it- … ro-programming/

Reply 3 of 42, by noop

User metadata
Rank Member
Rank
Member
Scali wrote:
noop wrote:

AdLib ports are redirected to SB OPL3 base port, seem to work ok.

I believe the earlier SB Pro, with dual OPL2, actually made writes to 388h go to both OPL2 chips at the same time.

Thanks, I know all that, having already programmed detection and port virtualization utils.
You also forgot address 228h, which is also supposed to be OPL2 emulation base port for compatibility with older SoundBlasters.
Thing is, it is a bit mysterious to me, if OPL3 takes 2 or 4 ports at 388 on many SB and SB-compatible cards and also on Adlib Gold, PAS etc.
OPL3 or 2x OPL2s are guaranteed to take 4 ports at 220, guaranteed to only take 2 ports at 228, but on 388, even official Creative documentation says about 2 ports taken on SB16, while some people tell me that the whole of OPL3 4 ports are actually available there on most/all cards.
For Adlib emulation this is unimportant, but, obviously, important for games that try to use OPL3 on Adlib base port, which obviously exist, because this is how it works on Adlib Gold at least.

Without having an actual CMI card to test, I decided to reliably support presence of OPL3 at 388 by redirecting it to the base port corresponding to 220.

There is also an issue of partial address decoding. Older hardware may actually not bother with decoding all address lines, leading to their regs being mirrored all over the address space and possibly conflicting (noticed this in earlier MPU401). Also, IIRC, port address space on earlier PCs is 12 bits. Dunno if there is an important software that depends on that.

Last edited by noop on 2018-03-14, 18:04. Edited 2 times in total.

Reply 4 of 42, by Scali

User metadata
Rank l33t
Rank
l33t
noop wrote:

You also forgot address 228h, which is also supposed to be OPL2 emulation base port for compatibility with older SoundBlasters.

Yes, that is another alias, but I don't think anyone ever used it.
Technically it's base-address+8, because it changes with the base address selection (388h is always fixed).

noop wrote:

Thing is, it is a bit mysterious to me, if OPL3 takes 2 or 4 ports at 388 on many SB and SB-compatible cards and also on Adlib Gold, PAS etc.

I have an SB Pro 2 myself, and it only has 2 ports at 388h.
As you say, the AdLib Gold is the one that has 4 ports at 388h (but I don't think it has them at 220h).
With other cards, I don't know. Perhaps some do, some don't.
DOSBox seems to emulate it (even when you select SBPro2, which is wrong).

http://scalibq.wordpress.com/just-keeping-it- … ro-programming/

Reply 5 of 42, by noop

User metadata
Rank Member
Rank
Member
Scali wrote:

DOSBox seems to emulate it (even when you select SBPro2, which is wrong).

Yeah, one of many cases where you can't rely on DOSbox. BTW, if there an easy way to set it up with support for port virtialization APIs?.

I won't be surprised even if different revisions of Creative SB cards support 388 differently. After all, they use DSP for emulating MPU401 UART on SB16+ with varying bugs depending on DSP microcode version, they have different implementations of OPL3 itself: real OPL3 with Yamaha DAC, CQM, real OPL3 with digital connection to emu8000..

Correction about base port and 220 not being fixed in stone is accepted, but obviously the text is easier to write and read if the default base port is assumed. Also, the utility can't change SB base port. I'm only planning to add that is somebody requests it, and improve my asm code meanwhile to make arbitrary changes easier.

Last edited by noop on 2018-03-14, 18:01. Edited 2 times in total.

Reply 6 of 42, by Scali

User metadata
Rank l33t
Rank
l33t
noop wrote:

BTW, if there an easy way to set it up with support for port virtialization APIs?.

Yea, I added support for inpout32.dll to my own custom version.
I wanted to add configuration for it, but haven't done so yet.
Currently I use it for printer port support, so I can test the OPL2LPT and other devices from Windows.

http://scalibq.wordpress.com/just-keeping-it- … ro-programming/

Reply 7 of 42, by 640K!enough

User metadata
Rank Oldbie
Rank
Oldbie
Scali wrote:

As you say, the AdLib Gold is the one that has 4 ports at 388h (but I don't think it has them at 220h).

Just for some additional context, the Ad Lib Gold used 388 to 38F by default for audio features. If I remember correctly, most of these were passed through the main control chip, so that not every write to the typical OPL port range will end up going to the on-board OPL3. This was used to detect the level of compliance with the Gold Sound Standard, for instance. GSS cards ignored 220 altogether, except when used with the (beta) SB emulation TSR.

Reply 8 of 42, by noop

User metadata
Rank Member
Rank
Member
640K!enough wrote:

detect the level of compliance with the Gold Sound Standard, for instance.

So, it may be worthwhile to emulate, for games that only play OPL3 FM on Adlib Gold and try detecting it, instead of running generic OPL3 detection?

Reply 9 of 42, by 640K!enough

User metadata
Rank Oldbie
Rank
Oldbie
noop wrote:

So, it may be worthwhile to emulate, for games that only play OPL3 FM on Adlib Gold and try detecting it, instead of running generic OPL3 detection?

I'm not sure that would be worth the effort. There were very few titles that even tried to use any of the features that would make this relevant. Most titles probably had generic support for OPL3 via 388 and used that. A notable exception, I think, was Dune (EDIT: Dune, not Dune II; my mistake), which could also make use of the reverb module.

Last edited by 640K!enough on 2018-03-14, 19:34. Edited 1 time in total.

Reply 10 of 42, by hard1k

User metadata
Rank Oldbie
Rank
Oldbie

A small correction - it was Dune, not Dune II.

Fortex, the A3D & XG/OPL3 accelerator (Vortex 2 + YMF744 combo sound card)
AWE64 Legacy
Please have a look at my wishlist (hosted on Amibay)

Reply 12 of 42, by cyclone3d

User metadata
Rank l33t++
Rank
l33t++

Cool project. Watching this thread now.

Yamaha modified setupds and drivers
Yamaha XG repository
YMF7x4 Guide
Aopen AW744L II SB-LINK

Reply 13 of 42, by Scali

User metadata
Rank l33t
Rank
l33t

Yea, Dune is a bit of a shame... It's one of very few games with OPL3 music, arguably the best OPL3 music ever made for a game... and it has a very strict AdLib Gold detection routine, so it really doesn't run on any other OPL3 hardware.
It's as if Dune was meant as a promotion for AdLib Gold.

http://scalibq.wordpress.com/just-keeping-it- … ro-programming/

Reply 14 of 42, by 640K!enough

User metadata
Rank Oldbie
Rank
Oldbie
Scali wrote:

Yea, Dune is a bit of a shame... It's one of very few games with OPL3 music, arguably the best OPL3 music ever made for a game... and it has a very strict AdLib Gold detection routine, so it really doesn't run on any other OPL3 hardware.
It's as if Dune was meant as a promotion for AdLib Gold.

I guess it could be that, as one of the earliest OPL3 cards, Ad Lib provided an early prototype for development. From what I've read, Ad Lib had a certain amount of input in the development of the OPL3, so maybe with early access, and maybe some arm-twisting (and money?), Ad Lib was able to secure exclusive support.

Still, for a few titles, would it be worth the development time to implement emulation features to fake the presence of the remaining hardware, while re-directing the music to an OPL3 equivalent? I don't own a copy of Dune, did it require a whole Gold 1000, or could other hardware be used for digital audio playback? What might Dune sound like without the reverb module?

Reply 15 of 42, by Scali

User metadata
Rank l33t
Rank
l33t
640K!enough wrote:

Still, for a few titles, would it be worth the development time to implement emulation features to fake the presence of the remaining hardware, while re-directing the music to an OPL3 equivalent?

That depends on how easy it is to fake it, I suppose.
It seems there is already a DOSBox patch for AdLib Gold support:
https://www.youtube.com/watch?v=YMAeteGRjuU

640K!enough wrote:

I don't own a copy of Dune, did it require a whole Gold 1000, or could other hardware be used for digital audio playback?

It doesn't have any digital audio afaik. You can only select one audio device anyway, so it's AdLib Gold or nothing.

640K!enough wrote:

What might Dune sound like without the reverb module?

Well, see the above video...
It basically sounds like the OPL2 version with stereo and slightly fancier instruments (which imho doesn't always make it sound better).

Dune is very picky anyway... if you just try to force it to use an 'AdLib Gold' at address 220h, on an SB Pro 2 or compatible card, the game just locks up.
So whatever detection and other stuff they do, it's not very forgiving.

http://scalibq.wordpress.com/just-keeping-it- … ro-programming/

Reply 16 of 42, by noop

User metadata
Rank Member
Rank
Member
640K!enough wrote:

What might Dune sound like without the reverb module?

Somebody said previously there is a patch already here on vogons. Apparently, this one: Re: Idea for Adlib Gold emulation?
Didn't try. youtube clips seem to be deleted.

Scali wrote:

It's one of very few games with OPL3 music

I thought many newer games support OPL3, if found, without advertising it too much. Descent, for example, sounds much nicer if OPL3 is enabled in dosbox vs opl2 or stereo opl2.

Last edited by noop on 2018-03-14, 23:19. Edited 1 time in total.

Reply 17 of 42, by Falcosoft

User metadata
Rank Oldbie
Rank
Oldbie

It doesn't have any digital audio afaik. You can only select one audio device anyway, so it's AdLib Gold or nothing.

If you select Sound Blaster as audio device Dune uses digital audio samples but you can count them on 1 hand 😀
As far as I remember: 1. In the intro when the worm appears 2. When you visit a sietch during fight.

Website, Facebook, Youtube
Falcosoft Soundfont Midi Player + Munt VSTi + BassMidi VSTi
VST Midi Driver Midi Mapper

Reply 18 of 42, by noop

User metadata
Rank Member
Rank
Member
640K!enough wrote:

I guess it could be that, as one of the earliest OPL3 cards, Ad Lib provided an early prototype for development. From what I've read, Ad Lib had a certain amount of input in the development of the OPL3

From what I've read it looks to me that Adlib spent some effort helping with development of OPL3 and MMA, while Creative just stole the result, putting it into SB Pro2 and later "borrowed" several other advertised features of Adlib Gold into SB16 (12-bit DAC that accepts 16 bits, samplerate-dependent digital antialiasing filter) while killing it with unfair competition practices.

Reply 19 of 42, by noop

User metadata
Rank Member
Rank
Member
640K!enough wrote:

If I remember correctly, most of these were passed through the main control chip

AFAIK MMA only serves as bus address decoder for OPL3. For all purposes it can be considered transparent if we are only concerned with OPL3 (and if mixer is alreadty set up properly).
4 MMA chip regs follow 4 OPL3 regs and the method of accessing its state mirrors OPL3.