VGA help

This is a discussion on VGA help within the C++ Programming forums, part of the General Programming Boards category; I'm having some trouble following the VGA tutorials on this site. I get all sorts of compiler errors whenever I ...

  1. #1
    Registered User
    Join Date
    Oct 2004
    Posts
    25

    VGA help

    I'm having some trouble following the VGA tutorials on this site. I get all sorts of compiler errors whenever I try the following program:


    #include <iostream> // Included lots of includes just to
    #include <stdlib.h> // make sure that I wasn't missing the one
    #include <dos.h> // that I needed
    #include <mem.h>
    #include <stdio.h>
    #include <conio.h>

    using namespace std;

    int main(void) {
    _AX = 0x0013; // first compiler error on this line: undefined function
    geninterrupt (0x10); // another similar compile error here


    cin.get();
    return 1;
    }



    Can someone help me?

  2. #2
    Registered User Rare177's Avatar
    Join Date
    May 2004
    Posts
    214
    could you please provide a bit more info , like your compiler and the exact error messages

  3. #3
    Registered User Rare177's Avatar
    Join Date
    May 2004
    Posts
    214
    also please edit your post and put the code tags in.
    thanks
    Last edited by Rare177; 10-05-2004 at 10:33 AM.

  4. #4
    Registered User
    Join Date
    Oct 2004
    Posts
    25
    Not sure what you mean by 'tags', but as for the other stuff:

    using the latest version of DevC++. The compilation errors are:



    11 D:\Dev-Cpp\pixelprog.cpp `_AX' undeclared (first use this function)
    12 D:\Dev-Cpp\pixelprog.cpp `geninterrupt' undeclared (first use this function)




    BTW: the file name is D:\Dev-Cpp\pixelprog.cpp

  5. #5
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    Problem is that _AX is undefined in the compiler as well as geninterrupt(). Those are valid in DOS Turbo C/C++ but maybe not DEV-C. I would recommend getting your hands on DJGPP and dump the dev stuff. DJGPP is 50 bazillion times easier and better and you will have a lot less heartache.

    Get it here:
    www.delorie.com

    Also works under Windows XP - but then so does Turbo C and Turbo C++. I've yet to find any major issues with programs running in the DOS shell for XP - save for certain int21h functions that either are not supported or not implemented.

  6. #6
    Registered User
    Join Date
    Jun 2004
    Posts
    722
    I would recomend you to first learn how to program and understand well C, or C++. Then you can go to hardcore stuff like VGA modes...

  7. #7
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398
    Click here for information on CODE TAGS.

    Standard & Non-standard C++...
    The C++ language standard is designed to be portable. Pure standard code will run on any machine (after being compiled for a particular platform). It will run on a simple computer with a text display, a keyboard, and disk storage. So, there are no graphics or VGA in standard C++. Every C++ compiler will have all of the standard headers and the associated standard library functions. (Well, they are not all 100% standard-compliant... but that's another discussion.)

    Most beginning C++ textbooks stick-to standard C++, so that the examples will work on any compiler/platform.

    This also means that most real-world programs contain some non-standard code. Most compilers will have additional headers & libraries. Every compiler has a different set of additional non-standard headers.

    Code:
    #include <iostream>  // Standard
    #include <stdlib.h>  // Standard, but should use <cstdlib>
    #include <dos.h>   // Non-standard
    #include <mem.h>  // Non-standard
    #include <stdio.h>  // Standard, but should use <cstdio>
    #include <conio.h>  // Non-standard, but very common
    You can check your compiler's documentation for stuff like _AX and geninterrupt. If you don't get any 'hits', then your compiler doesn't have them.

  8. #8
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Here is the exact problem my friend. You can't compile this code with your compiler. Look for one called Turbo C++ from Borland. Its a DOS compiler.

    By the way, code tags are just a way of formatting code on the forums.

  9. #9
    Registered User
    Join Date
    Oct 2004
    Posts
    25
    Thanks for the help. I'm searching for Turbo C++. Found a copy at borland's website, installed it, and it didn't have an executable file. I guess I'll keep searching.

    That's really annoying: having different compilers with different commands like that.

  10. #10
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    The one at Borland's site works just fine. You did not unzip it correctly. You may have to use the SUBST DOS function to fake an A: drive for the install program. I'm not sure that XP can do this, but I'm sure there is a workaround.

    And I would hardly call VGA programming hard-core stuff. I think it's an excellent place to begin learning. You can see the results of your code and you learn about pointers in the process. The drive to create bigger and better graphics, sounds, etc., will most certainly cause you to dive deeper and deeper into C/C++ and who knows what from there.

    Get DJGPP. It is ten thousand times better than Turbo C++ and it compiles just fine under XP. As well it is in protected mode so there are no memory constraints (theoretically).

    Try this in Turbo C++.

    unsigned char *Test=new unsigned char[999999999];

    Now try it in DJGPP. Given that you have enough RAM, it should work just fine.
    I really wouldn't even mess with real mode programming (All Borland Turbo C++ DOS compilers operate in real mode) unless you like self-inflicted pain.

  11. #11
    Registered User
    Join Date
    Jun 2004
    Posts
    722
    Maybe you'll want to take a look at this thread
    VDU memory

  12. #12
    Registered User
    Join Date
    Oct 2004
    Posts
    25
    I know VGA is pretty useless and has no future, but I'm interested in it because of the dodgy look it gives. Reminds me of my good old days of mario and commander keen. I've considered learning openGL graphics programming, but it does't have the same dodgy feel as the platformer games I grew up on (good old 320X200 16 colour games: I really miss them).

    Also, after learning QB for eight years, VGA graphics aren't entirely new to me. It seems a lot easier to put a dot on the screen in VGA than other modes, and the tutorials seem to show it as extremely simple stuff (like I can keep calling the same 2-3 line functions to do most of the work for me). Just writing to the memory a lot.

    I got DJGCC and it's IDE. It looks good. I'm having (more) problems getting it completely installed though. I had to create new 'environment variables' to djgcc\djgcc.env, but that file doesn't seem to exist, and DJGCC gives me error messages saying the .env file is corrupt (despite the fact that it doesn't exist). I'm getting more and more confused by the day.

  13. #13
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    The env file should have come with the installation package. I'm sure its there. Make sure you read the readme file prior to doing anything with DJGPP. It works like a charm on my system.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. VGA to TV
    By psychopath in forum Tech Board
    Replies: 6
    Last Post: 01-05-2008, 08:18 PM
  2. Patch not working for Police Quest 1 VGA
    By sean in forum A Brief History of Cprogramming.com
    Replies: 10
    Last Post: 08-05-2004, 09:01 AM
  3. Small VGA unit for DOS games
    By VirtualAce in forum Game Programming
    Replies: 1
    Last Post: 10-17-2003, 01:08 AM
  4. Dev-C++ VGA mode problems...
    By Ace Bowers in forum C++ Programming
    Replies: 9
    Last Post: 07-17-2003, 10:39 AM
  5. VGA Programming
    By JoshG in forum Game Programming
    Replies: 1
    Last Post: 08-01-2002, 05:14 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21