On Thu, 5 May 2011, Linards Ticmanis wrote:
On 05/05/2011 02:02 AM, D Finnigan wrote:KP wrote:I have a 4 meg RAM card in the memory slot of my ROM 03 IIgs. I have often heard that only the first 4 megs of expansion-card RAM is DMA- compatible. Can somebody explain what DMA actually is?DMA means Direct Memory Access and it's a way to alter the contents of memory without involving the CPU. In most cases, this makes the transfer faster.And if I remember correctly, DMA is used by cards with CPUs on them (Accelerators, CP/M Cards), the High Speed SCSI Card and not much else in the Apple II world. Please correct me if I'm wrong.
I wouldn't know, but there is a finite number that would actually benefit from DMA.For the original poster, DMA means accessing memory directly. If you have a serial port, the CPU hast to wait for a new character to come in (or have an interrupt tell it that a new character has come in), read the serial port into the accumulator or other register on the CPU, then save the contents of the acculator or other register to memory. For speed intensive applications, that slows it down.
So DMA allows a device to take control of the bus. So if it's a serial port, the serial port can grab the bus and issue an address on the address bus, and then write a byte directly into memory, then advance the address bus to the next location and then write another byte to that memory location. The CPU is out of the loop. Despite fast CPUs, there really are times when they aren't fast enough to do the software steps needed to move the byte from the port to the memory.
There can't be a lot of devices for the Apple II that is filling a lot of memory fast. If something is getting a steady flow of information, say from a hard drive, then it makes sense to add the needed hardware to the interface to take control of the bus. If it's only the occasional byte, then not only is it not worth the cost of the hardware, but it won't slow things down enough to bother.
While the Z80 card takes control of the bus, I'm not sure that's a good example of DMA, since it's outright using the RAM for its own purposes. An accelerator might do that too, or if it has its own RAM, it actually might do DMA in order to transfer large chunks of memory content back to the Apple II.
It's worth adding that the original IBM PC used a DMA controller to refresh RAM. It didn't need to do anything to the contents of the memory, but the DMA controller was an easy way to go through the memory space, which was needed to refresh it. One might argue that the video control circuitry in the Apple II is a DMA controller, since hardware takes over the bus during some of the clock phase, to read out the RAM content to the video output.
Michael