Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!apple!netcom!mojo From: mojo@netcom.UUCP (Morris Jones) Newsgroups: comp.windows.ms.programmer Subject: Re: Windows and Interrupts Message-ID: <18404@netcom.UUCP> Date: 9 Dec 90 15:21:11 GMT References: <1459@msa3b.UUCP> Reply-To: netcom!mojo@apple.com Organization: Netcom- The Bay Area's Public Access Unix System {408 241-9760 guest} Lines: 41 Kevin, I have several scanner drivers that receive communications via an arbitrary interrupt, and I've had no problems communicating with them via Windows enhanced mode. I use the int86 and int86x() functions. But there are some gotchas: If you need to pass a memory buffer to your driver, the Windows program must use GlobalDosAlloc() to get some memory that your device driver can access. Put the data there. GlobalDosAlloc() gives you both a selector and a segment address for the same area in memory. If you pass an address to your device driver using a segment register, i.e., ES:DX or whatever, then put the SELECTOR address in ES, because Windows will convert it to the segment address when you make the call. Or so it appears. (I don't believe this is documented, it just works.) If you pass the address in one of the GP registers, best use the SEGMENT address because I don't think it'll be touched. If you are doing multiple indirect addressing, that is, passing your device driver a pointer to a pointer to more memory, be certain that your second pointer is a SEGMENT address, not the selector, since of course your device driver will be called in real mode. During the course of discovering these things, I created functions to emulate int86x() that called the DPMI function which performs a real mode interrupt. Interestingly I found that there were occasions where my DPMI function would not work, but a call to int86x() from the library would. Go figure. As has been said other places here, DPMI is clearly not _fully_ implemented. Just enough to tease you into using it sometimes. :) Mojo Caere Corp. -- mojo@netcom.UUCP Site Coordinating Instructor, San Jose South Morris "Mojo" Jones Skilled Motorcycling And Rider Training (S.M.A.R.T.) Campbell, CA 800-675-5559 ... 800-CC-RIDER ... 408-423-2212 AA4KB @ N6LDL.#NOCAL.CA.USA.NA / aa4kb.ampr.org / netcom!mojo@apple.com