From: "Lawrence Rust" Newsgroups: comp.os.msdos.djgpp References: <80001018ab8d49d863fc783f466a2d0c DOT 98948 AT mygate DOT mailgate DOT org> Subject: Re: DMA in Windows Dos Box (Help requested) Lines: 52 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 Message-ID: Date: Wed, 26 Jun 2002 12:12:43 +0100 NNTP-Posting-Host: 62.253.142.12 X-Complaints-To: abuse AT ntlworld DOT com X-Trace: news8-gui.server.ntli.net 1025089971 62.253.142.12 (Wed, 26 Jun 2002 12:12:51 BST) NNTP-Posting-Date: Wed, 26 Jun 2002 12:12:51 BST Organization: ntl Cablemodem News Service To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com "Simone Navari" wrote... > I need to allocate a fixed and large memory block to use it as a DMA > buffer. In plain dos I use XMS to allocate and lock physical memory and > it works, but when I run the software under a Windows Dos Box the > operating system halts my program on the lock request ! > I've heard about VDS services but I've not yet understand if it can > resolve the problem and how to use it exatly. > I appraciate any kind of help. The solution for Win9x and ME is to use Virtual DMA services (VDS). This approach also works in DOS with EMM386. If you're using NT, Win2K or XP then you'll need to write a driver. For instance: /* DMA Descriptor Structure for VDS */ struct TDDS { ui32 dwSize; /* (00h) I/O: size of DMA region (bytes) */ ui32 dwOffset; /* (04h) IN: 32 bit virtual address */ ui32 dwSegSel; /* (08h) IN: segment/selector */ ui32 dwPhysicalAddr; /* (0Ch) OUT: Physical address */ }; struct TDDS dds; __dpmi_regs regs; /* Setup DMA descriptor */ dds.dwSize = (ui32)nNumBytes; dds.dwOffset = (ui32)pbData; dds.dwSegSel = (ui32)_my_ds(); /* Copy descriptor to real mode transfer buffer */ dosmemput( &dds, sizeof(dds), __tb); /* Set regs */ regs.x.ax = 0x8103; regs.x.dx = 0x000c; regs.x.es = __tb >> 4; /* transfer buffer address in ES:DI */ regs.x.di = __tb & 0x0f; regs.x.ss = 0; regs.x.sp = 0; regs.x.flags = 0; /* Call real mode VDS service */ __dpmi_int( 0x4b, ®s); HTH Lawrence Rust, Software Systems, www.softsystem.co.uk For the ear wiggers at GCHQ: Polonium-beryllium initiator The problem with Windows XP: http://www.arachnoid.com/boycott