Thread: Problems with dos.h

  1. #1
    Registered User
    Join Date
    Feb 2005
    Posts
    44

    Problems with dos.h

    Hi there,

    For some reason that I cannot fathom, #including dos.h is not working. I'm a fairly competent programmer and am quite familiar with using #include to include other files in my program.

    I am using C++Builder 5 with the updatepack 1. I have tested other STL H files which seem fine, but dos.h does not seem to have the functions it is supposed to.

    Specifically, I am trying to use MK_FP() (in the following context: )

    Code:
    unsigned char *vga = (unsigned char *) MK_FP(0xA000, 0);   // pointer to video card
    MK_FP() is apparently not defined.

    Is there something I'm missing? Has anybody else ever had this problem? I've been wracking my brain for hours over this - it just doesn't make sense to me.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Probably because your compiler isn't a DOS compiler (it may be able to generate command line programs, but they're not DOS programs, despite the initial visual similarity).

    Protected operating systems do not allow user programs to randomly point at absolute memory addresses.

    Now, what is your real question - like what are you trying to do with that memory - your own graphics library perhaps?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Feb 2005
    Posts
    44
    Well, I actually have a source code for a simple DOS game "Snaker" - I actually downloaded it from the site.

    I'm trying to compile the source so that I can make minor changes to "get used to" graphics programming.

    I think you're right. I was told that I should really be doing this with OpenGL or DirectX but I just don't get any of that stuff - hence why I'm picking apart the source code of a simple game - I find that the best way to learn.

    What I didn't know is that a new compiler wouldn't work with older code. I guess what I need is some kind of DirectX tutorial for idiots

  4. #4
    Registered User
    Join Date
    Aug 2003
    Posts
    1,218
    Or, if you find DirectX/opengl too hard you can always try SDL or allegro.

  5. #5
    Registered User
    Join Date
    Feb 2005
    Posts
    44
    Well, I'd like to try DirectX. I know a lot of people say that it is bulky and horribly done, but I'm really impressed with all of the games that make use of DX8 and probably even moreso DX9 when games start taking advantage of it.

    Does anybody have any kind of idea where I should start? I have a strong syntax background and am getting better with design and algorithms - but I know absolutely nothing (really) about graphics programming. If anybody had seen a tutorial for newbies around anywhere and could point me to it, that would be great.

  6. #6
    Registered User
    Join Date
    Aug 2003
    Posts
    1,218
    I know http://www.amazon.com is a good place to check.

  7. #7
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398

    dos.h is non-standard.

    dos.h does not seem to have the functions it is supposed to.
    You'd have to check your compiler's documentation (or help files).

    dos.h is non-standard. This means two things:
    1. Not all compilers have it.
    2. One compiler's dos.h will be different from another compiler's dos.h.


    There's nothing wrong with including non-standard if you have to... All graphics are non-standard. (Except for the "fake" graphics you can create with ASCII characters.)

    With Windows 98 or older (and maybe Windows ME) you can directly read-write to a hardware address, but like Salem said, the newer Windows implimentations will block access.

    I don't know where to start learning one of the graphics libraries... I sort-of have the impression you should learn Windows (or another GUI) programming first. (?)

  8. #8
    Registered User
    Join Date
    Aug 2003
    Posts
    1,218
    >>I sort-of have the impression you should learn Windows (or another GUI) programming first. (?)

    That is not the case! The best way to use Windows when dealing with either directx or opengl is to know how to setup a DirectX/opengl window and be done with it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. No clue how to make a code to solve problems!
    By ctnzn in forum C Programming
    Replies: 8
    Last Post: 10-16-2008, 02:59 AM
  2. C Pointers Problems
    By mhelal in forum C Programming
    Replies: 8
    Last Post: 01-10-2007, 06:35 AM
  3. String Manipulation problems -_-
    By Astra in forum C Programming
    Replies: 5
    Last Post: 12-13-2006, 05:48 PM
  4. DJGPP problems
    By stormswift in forum C Programming
    Replies: 2
    Last Post: 02-26-2002, 04:35 PM
  5. where do i get dos.h???
    By Quin in forum C Programming
    Replies: 1
    Last Post: 01-13-2002, 05:05 PM