Date: Sun, 14 Nov 1999 08:38:31 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: "Updegrove, Timothy (Tim)" cc: djgpp AT delorie DOT com Subject: RE: Allocating DOS memory in Windows In-Reply-To: <2723E6389F55D311BDC200508B129547395A58@pai820exch003u.micro.lucent.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Thu, 11 Nov 1999, Updegrove, Timothy (Tim) wrote: > From Tim: I called it a DMA controller because hardware transfers the data > once descriptors are setup. It really is a memory-mapped device. Then you should in general use the techniques described in section 18.7 of the FAQ (since the device is mapped above 1MB). > I didn't know about dosmemget/dosmemput, I was using _farpeekl and _farpokel > which have worked fine up to this point. Could this explain my problem? I don't think so. _far* functions are equivalent to dosmemget/dosmemput, except for the following differences: - dosmem* functions assume that the offset you pass is relative to the _dos_ds selector (this selector spans the entire conventional memory plus the HMA), whereas _far* functions require that you pass the selector explicitly. Therefore, dosmem* functions are not appropriate to reference selectors other than _dos_ds. - dosmem* functions are faster when moving large buffers. > They were used for writing and reading the memory-mapped registers, which > works fine in DOS and Windows, and these functions were used to read and > write DOS allocated memory, which has a problem. Are those memory-mapped registers also mapped above 1MB mark? > From Tim: the device is mapped above 1MB but I allocated buffer space for > descriptors in DOS memory. I don't understand this. What buffer space for descriptors did you need to allocate, and why? What descriptors are we talking about here? Segment descriptors (if that's what you mean) are allocated by the DPMI server, so you never need to do that on your own. > Should _farpeek and _farpoke be used above 1MB > for the memory-mapped area and dosmemget/put used to read and write the DOS > allocated memory (this is what I'll try)? dosmemget/put cannot be used above 1MB mark, but below that mark _far* functions and dosmemget/put are equivalent. However, note that if you use _far* functions in conjunction with a selector that is NOT _dos_ds, then the offset you pass to _far* functions should NOT be seg*16 (where seg is what __dpmi_allocate_dos_memory returns). In other words, if you use the selector returned by __dpmi_allocate_dos_memory, the offset of the first byte of the allocated buffer is zero, not seg*16. This *is* important.