www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/04/13/10:25:24

Date: Thu, 13 Apr 2000 15:39:43 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Chewbaklava <kalit AT ctel DOT net>
cc: djgpp AT delorie DOT com
Subject: Re: Graphics
In-Reply-To: <tB8J4.1635$O2.25478@harpo>
Message-ID: <Pine.SUN.3.91.1000413153215.29939B-100000@is>
MIME-Version: 1.0
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

On Wed, 12 Apr 2000, Chewbaklava wrote:

> My question is this, I see people set mode 13h 2 ways, both work
> fine.  is there any differance between saying (and I'm doing this from
> memory, so if the syntax is a little wrong...)
> 
> union REGS regs;
> regs.x.ax = 0x13;
> int86(0x10, &reg, &regs);
> 
> and
> 
> __dpmi_regs r;
> r.x.ax = 0x13;
> __dpmi_int(0x10, &r);

As Damian suggested, __dpmi_int is the recommended way.  The docs of the 
int86 functions (in the library reference, libc.info) give you some clue 
as to why.  The DJGPP FAQ list explains in section 18.1 why int86 might 
be dangerous.

> Both of these methods work, and as far as I can see do absolutly the same
> thing.

They accomplish similar things, but in different ways.  int86 issues the 
INT NN instruction in protected mode, whereas __dpmi_int calls a DPMI 
service which switches the CPU to real mode, then issues the INT NN 
instruction.  The former way is limited to register-based services (no 
buffers) and is known to cause trouble with some obscure services, in 
addition to the 16/32-bit nuisance referred to in the docs mentioned 
above.

So __dpmi_int is a better way.

> This
> is speed sensitive, so I would like to know, what does farpokeb do
> exactly???

Look at the header sys/farptr.h, it's all there spelled out in inline 
assembly.  Section 18.6 in the FAQ discusses the relative merits and 
demerits of _far* functions and the nearptr hack.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019