Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!mcsun!unido!rwthinf!slcdec!hippo!f1.n6000.z2.fidonet.org!p4.f36.n245.z2.fidonet.org!Norbert_Unterberg From: Norbert_Unterberg@p4.f36.n245.z2.fidonet.org (Norbert Unterberg) Newsgroups: comp.windows.ms.programmer Subject: Accessing data between 640K and 1M from Windows. Message-ID: <1711913836@p4.f36.n245.z2.fidonet.org> Date: 12 Jun 91 09:03:00 GMT References: <8141@p1.f6.n242.z2.fidonet.org> Reply-To: Norbert_Unterberg%p4.f36.n245.z2@hippo.dfv.rwth-aachen.de (Norbert Unterberg) Organization: Point of SoftStream, Dortmund, Germany Lines: 39 Comment-To: Don_Wilcox@f1.n6000.z2.fidonet.org (Don Wilcox) > I am attempting to write a Windows 3.0 program which interfaces with a > part- > icularly ill-behaved I/O card. It acquires binary data (about 230K > worth) from > an external device, and then writes this data into memory starting at > 0xb00000. Use the DPMI. The DPMI (Dos Protected Mode Interface) is an API that provides the neccessary functions to "reach" your ill-behaved I/O card from protected mode (that is Windows in standard or enhanced mode). You can get a free copy of the specification from Intel. There is another way to reach the address space between A0000 and FFFFF. Windows (or the SDK) as a set of built in selectors called __A000H, __B000H, __B800H, __C000H etc. Microsoft sais thar they are only accessible from assembly language (they are constant values in the library, not variables!), but with a little trick they can be used from within C. To read data from your i/o card at address 0xb0000h, use the following code: . . extern WORD _B000H; LPBYTE lpMyCard; lpMyCard = (LPSTR)MAKELONG(0, (NPSTR)&_B000H); This declares the identifier _B000H as an external word. The linker resolves the reference in a way that the address (offset) of thar identifier has the value __B000H which is the selector. The MAKELONG statement genereates a far pointer from that value. This pointer can be used like any other far pointer to access the i/o card. But it is only valid in the area between B000:0 and B000:FFFF. For the next segment you must repeat the step with _C000H and so on. Sorry, I've just seen thar your address is 0xB00000 and not 0xB0000. Then the only way is using the DPMI. But this post may be interesting to some other reader, so I don't delete the text... Norbert