#### Archived

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

# dos c question

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

## Recommended Posts

So I've been trying to run this program:
  ------------------------------------------------------ // INCLUDES /////////////////////////////////////////////// #include #include #include #include // DEFINES /////////////////////////////////////////////// #define VGA256 0X13 // 320x200x256 #define TEXT_MODE 0x13 // The default text mode // FUNCTIONS ///////////////////////////////////////////// void Set_Video_Mode(int mode) { // Use video interrupt 10h to set the video mode to the sent // value union REGS inregs, outregs; inregs.h.ah = 0; // Set the video mode subfonction. inregs.h.al = (unsigned char)mode; // video mode to which to change. int86(0x10, &inregs, &outregs); } // end Set_Video_Mode void main(void) { // Set the video mode to the 320x200, 256-color mode. Set_Video_Mode(VGA256); // wait for a key to be hit. while(!kbhit()) {} // Put the computer back into text mode. Set_Video_Mode(TEXT_MODE); } // end main ---------------------------------------------------- 
But it(borland 5) tells me errors like "undefined structure 'REGS'" or "call to undefined function int86". or the funnyiest is: "parameter 'mode' is never used". But it IS used! [edit: added source tags, btw you code like a girl (j/k)] Edited by - Magmai Kai Holmlor on January 3, 2002 10:51:39 PM

##### Share on other sites
I am not sure if this will work but let me ask.. what header files are you including into your code...because, REGS is defined in a header file called dos.h (I think ?????) so, try including dos.h into your code and then it may work.

Let me know how it goes

Dark Star
UK

##### Share on other sites
oh, yeah, I include dos.h, it''s just that you don''t see it.

You gotta do this with borland or something more dos-compatible than visual studio.

##### Share on other sites
#include <regs.h>

It thinks mode isn''t used because it thinks inregs isn''t used, because it thinks int86 doesn''t exist.

The Borland compilers build dependancy trees and will scoff at you if there isn''t an undeniable dependacy on the variable and often optimize it right out of the compiled code for you (irritates the living @#$@#$ out of me when I try to add some debugging code)

##### Share on other sites
hey, did you know it''s André LaMothe''s code you''re talking about?
hehe

##### Share on other sites
Nothing against Andre, but after reading Trick of the Windows Game Programming Gurus, personally, I''m NOT trusting his code. Its either he doesn''t proof-read his code, or someone else wrote them. Heck, they didn''t even try to compile the code. Though this is more rare. Most of them are just semantically wrong.

##### Share on other sites
Maybe I got a later version with better code, but the only one that never worked for me was Chapter 7. And a fix is posted somewhere in these forums for those.

---
Make it work.
Make it fast.

##### Share on other sites
Hmm... Check your settings and make sure you are compiling the program for DOS, not windows. A 32-bit application cannot use BIOS directly. It must be a 16-bit DOS application...

Later

##### Share on other sites
quote:
Original post by Anesthesia
Hmm... Check your settings and make sure you are compiling the program for DOS, not windows. A 32-bit application cannot use BIOS directly. It must be a 16-bit DOS application...

Later

how do I do that?

##### Share on other sites
quote:
Original post by jellocaca
hey, did you know it''s André LaMothe''s code you''re talking about?
hehe

Hola! Don''t tell him I said that (that guy looks like he could teach a brick wall a good lesson)

You are using Borland Turbo C, right? That book you have there is, well, archaic and requires an old compiler. TotWGPG is the new(er) one for Win32 & Dx5/6.

• ### Forum Statistics

• Total Topics
628726
• Total Posts
2984410

• 25
• 11
• 10
• 16
• 14