Date: Wed, 15 Oct 1997 13:01:56 +0200 (IST) From: Eli Zaretskii To: Peter Scargill cc: djgpp AT delorie DOT com Subject: Re: Physical address from array ? Not a clue! In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On Tue, 14 Oct 1997, Peter Scargill wrote: > I'm really having trouble getting my head around this. given an array, > lets say "fred[70000]" how do you get the PHYSICAL address into an int so > you can pass that to, say, a dma chip which is ready to accept a 32-bit > address. One way is to use the VDS (Virtual DMA Services) API. The API is actually a bunch of functions of Interrupt 4Bh which you can look up e.g. in Ralf Brown's Interrupt List. Microsoft also has a VDS specification which can be downloaded. The relevant function there is function 8103h, Lock DMA Buffer. You pass it a pointer to your buffer, and if it returns a physical address of a locked buffer that can be used for DMA. (There's much more to it than I've told; in particular, it might return the address of an entirely different buffer, if your buffer doesn't meet all the DMA requirements. Please read the description of this function for a complete picture.) Please note that currently, VDS is not available if you run CWSDPMI with no other memory manager. You need to install a memory manager such as EMM386 or QEMM, or run under Windows, to get VDS support. I imagine that if you allocate a DOS buffer, you can use its address as the physical address, since DOS memory is usually mapped 1-to-1. You might consider checking out Allegro sources to see how does it do DMA.