Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

FX

Registers and C

This topic is 6111 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Im playing around with video modes and im trying to set the video mode to 13h, a standard 320x200 mode but when i run the code union REGS regs; regs.x.ax = 0x13; int86( 0x10, ®s, ®s ); I receive a serious General protection fault error. I managed to narrow it down to the above lines, it seems i get this error when the video mode is trying to be set. Im running Win2k and compiling using DJGPP with gcc 2.953 Exiting due to signal SIGSEGV General Protection Fault at eip=00011989 eax=6168732f ebx=00591510 ecx=00000059 edx=6168732f esi=00000054 edi=000291d4 ebp=0058ff30 esp=0058ff24 program=C:\TEMP\STARS.EXE cs: sel=01a7 base=017b0000 limit=0059ffff ds: sel=01af base=017b0000 limit=0059ffff es: sel=01af base=017b0000 limit=0059ffff fs: sel=017f base=00005800 limit=0000ffff gs: sel=01bf base=00000000 limit=0010ffff ss: sel=01af base=017b0000 limit=0059ffff App stack: [00590000..00510000] Exceptn stack: [00029128..000271e8] Call frame traceback EIPs: 0x00011989 0x0000e683 0x0000190b 0x000016fd 0x00010ca2 after the program is run this is the result i get ... anyone have any ideas .. or any suggestions on a different way to do this

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
i''m not quite sure but what you are trying to do is use a dos function, but win2k doens''t have a dos kernel anymore so i don''t think you can only do that on win98/me and below...

Share this post


Link to post
Share on other sites
all im trying to do is set the video mode in my program to the old standard bios mode of 13h and then call int10 which should set the display to 320x200 but instead i get all that register dumps above.

You mentioned that win2k no longer supports the dos kernel so im guessing what im trying to do is set the video mode through the bios wont work.

Unfortunely i cant check if this is the case on win98/me because im only running 2k.

Share this post


Link to post
Share on other sites
DOS used to allow you to do all those kind of under the hood tricks, but its not the same anymore in Windows, the windows kernel makes sure you cant just poke around the bios and system calls without doing even more tricks, do you have a DOS/Win95/98 bootdisk? try running your program booting with that, if you see no problems, then you can blame Windows.

Share this post


Link to post
Share on other sites
DOS programs in Win2K can switch to int10h modes; NTVDM traps the call and does "the right thing".

However, I do not believe that Win32 programs can do so.

Share this post


Link to post
Share on other sites
I''m pretty sure that DOS programs, even those that use Mode13h, will run under WinNT/2k. This may have something to do with DJGPP''s DPMI server. You could try to use the following code, which I use. It is essentially your code, but it uses compiler-specific DPMI server commands:

  
void setmode13h()
{
__dpmi_regs r;
r.x.ax = 0x13;
__dpmi_int(0x10, &r);
}

void settextmode()
{
__dpmi_regs r;
r.x.ax = 0x3;
__dpmi_int(0x10, &r);
}

Share this post


Link to post
Share on other sites
I think this is why everybody else is using Direct Draw/X.

It certainly does the right thing.

When programming for Windows, you are not supposed to bother the poor little bios. Leave it alone, will you?

Edited by - Askadar on December 30, 2001 9:35:21 PM

Share this post


Link to post
Share on other sites
TerranFury is quite correct. DJGPP''s int86() only supports a small portion of the possible interrupts, and should not be used. Use the __dpmi family of functions instead, and your program will work fine in Win2k. For more info, see the DJGPP docs.

Share this post


Link to post
Share on other sites
Great guys .. i will give this a try .. thx for the input

and im not doing windows programming, im playing around with the simplest of video modes just as an exercise to see what can be done ..

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!