Date: Mon, 12 Feb 2001 21:13:32 +0200 From: "Eli Zaretskii" Sender: halo1 AT zahav DOT net DOT il To: djgpp AT delorie DOT com Message-Id: <7263-Mon12Feb2001211331+0200-eliz@is.elta.co.il> X-Mailer: Emacs 20.6 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.6 In-reply-to: <96917s$guccd$1@ID-57378.news.dfncis.de> (dummy_addressee AT hotmail DOT com) Subject: Re: inline asm References: <96917s$guccd$1 AT ID-57378 DOT news DOT dfncis DOT de> 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 > From: "Alexei A. Frounze" > Newsgroups: comp.os.msdos.djgpp > Date: Mon, 12 Feb 2001 11:00:07 -0500 > > > > On Sun, 11 Feb 2001, Jeremiah wrote: > > > > > How do i call interrupts with inline assembly in djgpp compiler. like: > > > int 25h > > > > You don't need inline assembly for that, use __dpmi_int instead. The > > DJGPP FAQ shows how to do that in section 18.2 and other sections of > > chapter 18. > > > > Issuing an INT instruction in assembly is not a good idea with DJGPP, > > since your program runs in protected mode, so the INT instruction is > > handled by protected-mode handler first. Who knows what that will do? > > TechHelp says this (on int 31h fn 300h = simulate real-mode interrupt): > -------8<-------- > The DPMI host automatically handles all INT nn opcodes to provide > BIOS and DOS services transparently. I'm not sure why you would > use this fn. > -------8<-------- > So what's the problem? If this is what TechHelp says, perhaps you should toss it and read the DJGPP FAQ (sections 18.1 and 18.2) instead ;-) ``References'' like this really make a disservice to a programmer by proliferating disinformation. First of all, Int 25h requires a pointer to a buffer in DS:BX, and the buffer needs to be in the low memory (below 1MB mark), since real-mode addressing cannot reach higher addresses. In contrast, a protected-mode program has all its buffers above 1MB mark--problem no.1. In addition, different DPMI environments have different exciting problems with specific interrupts when they are invoked as INT nn instruction in protected mode. For example, Int 2Fh, if issued in protected mode on certain configurations of Windows 9X wedges the DOS box so hard that the only thing you can do is kill the VM--problem no.2. Going through function 300h of Int 31h (i.e. via __dpmi_int) does not have all these problems. In other words, Int 31h/AX=0300h was _designed_ to handle real-mode interrupts, and the designers intended that programs will use it to call real-mode services. By contrast, INT nn issued in protected mode was _never_ designed to handle real-mode services, so they work or don't work by sheer coincidence, luck, or the lack thereof.