Mail Archives: djgpp/2000/04/13/10:25:24
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, ®, ®s);
>
> 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 -