Re: [Dev-C++] Where are int86() and union REGS?
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: David M. <dml...@co...> - 2004-08-23 02:31:14
|
What version of windows are you running if you are running any version
of NT (including 2000 & XP) then no matter what the compiler you will
get this crash. You will have to use a graphics library to program
graphics on any of these OSes (allegro, SDL, OpenGL, DirectX, are some
options you can look into.
James Dent wrote:
> Hello.
> I have been trying to program some low-level graphics routines for a
> console application. All of the
> C++ books I have read have used the data structure union REGS to
> represent the registry, and
> functions such as int86(), outport, etc. etc. (included in dos.h).
> This header may be obsolete, or
> a Borland extension of C++ - I don't know. I turned to assembly to
> accomplish the same function,
> but the code shown below resulted in the Blue Screen of Death when the
> 'int' command was
> called.
>
> int mode = -1;
>
> void SetVideoMode (int local_mode)
> {
> // This function consists of two parts: firstly, it saves the current
> // video mode in the global variable oldmode, and secondly, it loads
> // various values into the registry and calls the Video BIOS interrupt
> // for changing screen mode.
>
> mode = local_mode;
>
> asm( "movb $0xF,%ah" ); // The BIOS interrupt to
> return
> // the video
> mode.
> asm( "int $0x10" ); // The Video BIOS
> interrupt.
> asm( "movb %al,_oldmode" ); // Stick the mode value (in
> %al)
> // into the
> variable oldmode. */
>
> // The old mode has been retrieved, now all that needs to be done
> is the
> // actual mode changing.
>
> asm( "movb $0x0,%ah" ); // Interrupt 0h - Screen
> mode.
> asm( "movb _mode,%al" ); // Put the mode into %al
> asm( "int $0x10" ); // Video BIOS interrupt.
> }
>
> I have never been very good at assembly, but this code has been
> terribly hard to debug. Does anyone
> know if a new version of the dos.h functions exists for Dev-C++, or
> how to use assembly to the
> same extent?
>
> Gratefully,
>
>> From the Assembly-Migraine afflicted.
>
|