• Please review our updated Terms and Rules here

Why were there no sound cards using memory-mapped I/O?

digger

Experienced Member
Joined
Jul 9, 2008
Messages
395
Location
Amsterdam, the Netherlands
Here's a question to ponder on and debate on a quiet Sunday afternoon... :)

As is well known, most sound cards in the DOS era used DMA to enable sound output (and input) at low CPU utilization. Sound solutions that lacked DMA capability, such as the internal speaker, or an LPT DAC, required excessive CPU power if one wanted to do anything interesting, such as mixing and outputting digital PCM sound.

But there was also a third possible option that was already being used in graphics cards and other hardware, namely memory-mapped I/O. A sound card could've had dedicated memory on the card, say 32KB or perhaps even 64KB, just enough for containing a MIDI/FM playlist and a PCM audio buffer. After sending the audio or music data to the memory-mapped buffer, all the CPU would then have to do is instruct the sound card to process it, by sending it the correct commands through I/O ports, and then the sound card would take care of things independently.

Of course it would require a sound card to be a bit smarter, but then again: the added complexity would have been negated by being able to do away with a DMA controller on the card.

Also, it would have been easier to maintain hardware compatibility when the transition from ISA to PCI was made in the early and mid 90s.

So what I'm wondering is why no sound card manufacturer ever tried going down the memory-mapped I/O route as a viable alternative to DMA-based audio solutions?

Perhaps there were good practical reasons for that? (For instance, a DMA controller might have been much cheaper than dedicated RAM on the card? I don't know?)

Any ideas?
 
Probably because, from a programming perspective, it's not significantly less of a pain than CPU-driven sound unless you're only doing single samples that fit into sample RAM - if you're doing any kind of software mixing, the CPU still has to transfer a whole buffer to the card manually every time the buffer runs out.

Also, there was the Gravis Ultrasound, though I don't know if that was actually mapped into main memory or not. But that had comprehensive mixing facilities on the card, not just simple buffer playback.
 
The sound card doesn't have a DMA controller on it - the DMA controller is on the motherboard. From the point of view of a peripheral such as a sound card, DMA is much simpler - it's just the 8 bit bus for the data and two control lines (DMA request and acknowledge). Having onboard memory is much more complex - as well as the cost of the RAM itself (not completely trivial when the first sound cards were being designed) there's all the complexity of making that RAM addressable from the bus, doing refresh cycles, and coordinating the CPU accesses with the audio input/output accesses. Essentially you'd have to implement both (the moral equivalent of) a DMA controller and a DMA device on the card as well as all the RAM stuff.

About the only thing you'd gain would be the ability to use RAM above 640KB for your audio buffer on an XT-class machine, but probably when the first sound cards were coming out most machines didn't have 640KB anyway, so if you're talking about adding extra RAM to the machine you might as well add it to the motherboard (where other applications can use it when it's not being used for audio) rather than to a sound card.
 
Also sound cards like SoundBlaster are conceptually simple - just a timer and a single-byte DAC really. Once set up it simply loads the next sample at exacly the right moment from memory, so DMA is a really easy way to make that happen as the timer on the card just counts down to zero at which point DRQ is triggered and the DMA controller does the work.
 
32-64K of the upper memory map is an infeasble amount of memory for a lowly sound card to take. You only have 384K, the BIOS can take 64K, maybe more, VGA 128K, Expanded Memory 64K, SCSI BIOS at least 8K, and you want some upper memory available to load DOS drivers. That area gets really tight, really fast.

Also, your memory is stuck on the ISA bus, and memory transfers from system RAM to expansion card RAM get slower as the CPU gets faster. While your CPU may be communicating with your onboard RAM at 33MHz, expansion card RAM gets 8.33MHz at best.
 
So what I'm wondering is why no sound card manufacturer ever tried going down the memory-mapped I/O route as a viable alternative to DMA-based audio solutions?

Some did. I believe the Turtle Beach Multisound did this, and maybe some other specialized cards (signal acquisition).

I can only guess as to why everyone didn't do this, but it was probably a combination of component cost and compatibility (asking the user to find a 32K hole in upper memory was never a good idea; PC's were already difficult enough to use).
 
1. DMA worked quite well
2. Sound Blaster was designed with DMA... others tried to be compatible with the Sound Blaster
3. Memory mapped I/O itself is a bit problematic on 386+ systems that might have shadow memory. Not mentioning additional configuration complications (selecting an unused memory range), vs. selecting IRQ + DMA (and in most cases default IRQ and DMA channel were used - something like IRQ7/DMA1 or IRQ5/DMA1 in later models).
4. Memory cost (it was pretty expensive back then).
5. Memory mapped I/O implementation would require CPU time to copy data from the main memory to the sound card memory. This theoretically could be mitigated by having a really large memory on the sound card and preloading samples to it, and then even mixing these samples as necessary. But see (4) and also it would complicate the hardware.
 
To add to this, remember that typical soundcard audio was 22Khz 8-bit, and you don't need the performance of a memory window for 22050 bytes a second. Specialized cards probably did because they were slinging (44.1*16-bit*stereo) = 176400 bytes a second to disk for recording. These cards were 2+ years before the PAS16 and SB16 when slow 386s (maybe 286, you'd have to check the Multisound hardware requirements) were the target host for the cards.
 
Am I correct in thinking that the sound card memory access is pretty much a FIFO? There'd be no reason to put the addressing space of a FIFO in the PC memory map. For example, my tape drive controller has 256K of memory in a FIFO arrangement and none of it is visible in the PC address space. FIFO memory is private to the card and you get an I/O port to push stuff in or take stuff out. All the memory in the middle just serves as a giant shock absorber.

Using great chunks of main addressing space would make no sense. Besides, DMA is available--and you could even use it to keep your FIFO full, if you had one.
 
Back
Top