Date: Mon, 6 Nov 2000 19:41:29 -0700 From: Bill Currie To: djgpp AT delorie DOT com Subject: Re: int 21h and assembler Message-ID: <20001106194129.A16369@taniwha.org> Mail-Followup-To: djgpp AT delorie DOT com References: <8u7ft0$6r3$1 AT nnrp1 DOT deja DOT com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0.1i In-Reply-To: <8u7ft0$6r3$1@nnrp1.deja.com>; from danspam2000@my-deja.com on Mon, Nov 06, 2000 at 11:46:42PM +0000 Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Mon, Nov 06, 2000 at 11:46:42PM +0000, danspam2000 AT my-deja DOT com wrote: > I am quite new to assembler, but i need to service a hardware interrupt > very quickly, so have had to code using inline assembler code. > > The problem i have is that i can't seem to get a definitive answer > about how to protect the service routine in memory. I think that i > should use int 21H, but some books and lists say to use service 48 and > some say 49, and one said 27! Also, i am not sure exactly what i need > to pass, and using which registers (some say dx and some say bx), do i > need to pass a segment or an offset, or both? Hoh bouy, you've got some confused sources of information. Sounds like they can't even agree whether to use hex or not. However, the 49 sounds like the decimal version of the DPMI interrtup (0x31). As you are in DJGPP, forget just about every source of information out there and use the definitive guild: the DPMI spec. either ftp://qdeck.com/pub/memory/dpmispec.zip (wasn't responding when I tried) or ftp://x2ftp.oulu.fi/pub/msdos/programming/specs/dpmispec.arj (you will have to use save-as in netscape: I got a screen full of giberish:). There is also ftp://x2ftp.oulu.fi/pub/msdos/programming/specs/dpmi100.zip which is the DPMI 1.0 spec which is not supported by Windows and only partially supported by cwsdpmi, but is an excellent source of information (my hardcopy got dog-eared pretty quickly). Or for the terminally lazy, there's http://www.delorie.com/djgpp/doc/dpmi/ :) (btw, I got all these from the djgpp faq). What you need to do is look up the sections on getting/setting interrupt vectors and locking/unlocking memory pages. Locking your interrupt memory is very important because not doing so can cause lots of trouble (and cwsdpmi will kill your program if you don't (been there, done that:)). There is plenty of example code out there, but you need to narrow down your search to djgpp specific code. I believe all the djgpp serial port drivers are good sources of info (I know bcsio is if you can read asm:). If you sort out just what you need to know (more specific questions will help:), you will get more ready answers. Oh, you will probably also file the sections on real mode callbacks in the dpmi specs helpfull too. Bill -- Leave others their otherness. -- Aratak