Mail Archives: djgpp/1999/02/04/05:18:13
At 05:14 PM 2/2/99 -0800, you wrote:
>#include <dpmi.h>
>
>void set_mode(int m)
>{
> __dpmi_regs r;
> r.h.ah = 0;
> r.h.al = m;
> __dpmi_int(0x10, &r);
>}
>
>int get_mode(void)
>{
> __dpmi_regs r;
> r.h.ah = 0x0f;
> __dpmi_int(0x10, &r);
> return r.h.al;
>}
Thanks again. I tested the code and it works perfectly. I wrote a test
applet that got the current mode, set mode 13h, then restored the original
mode, reporting info on each step and waiting for a keypress at each step.
One question. How does one tell if the mode could not be set? the set_mode
you supplied doesn't appear to do any specific error checking, and it
doesn't return anything. I'd like to know how to modify the set_mode to
detect an error, which presumably would mean the mode requested isn't
available on the hardware.
Your set_mode passes the ADDRESS of a struct to __dpmi_int(), so I'd guess
that something in the struct is changed to reflect the error/success status
of the function. So checking some property of r should be done, I'd guess.
Or possibly checking the return code of __dpmi_int(), which is specified as
returning an int.
--
.*. "Clouds are not spheres, mountains are not cones, coastlines are not
-() < circles, and bark is not smooth, nor does lightning travel in a
`*' straight line." -------------------------------------------------
-- B. Mandelbrot |http://surf.to/pgd.net
_____________________ ____|________ Paul Derbyshire pderbysh AT usa DOT net
Programmer & Humanist|ICQ: 10423848|
- Raw text -