Thread: mode13h

  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    27

    Unhappy mode13h

    Is it possible to get into Mode13h in Borland C++ 5.01, or Dev-C++ 4.0.. If so, how? :'(

  2. #2
    Registered User
    Join Date
    Mar 2002
    Posts
    24

    Small function for Mode 13 using a Borland compiler

    Here's some "borrowed" code you can use as a function:

    void Set_Graphics_Mode(int mode)
    {

    // use the video interrupt 10h and the C interrupt function to set
    // the video mode

    union REGS inregs,outregs;

    inregs.h.ah = 0; // set video mode sub-function
    inregs.h.al = (unsigned char)mode; // video mode to change to

    int86(0x10, &inregs, &outregs);

    } // end Set_Graphics_Mode



    In your programs, you could do as such:

    #define GRAPHICS_MODE13 0x13
    #define TEXT_MODE 0x03


    And to use the function:

    Set_Graphics_Mode(GRAPHICS_MODE13)

    Hope that helps ;-)
    Last edited by WHurricane16; 03-30-2002 at 10:19 PM.

  3. #3
    The Earth is not flat. Clyde's Avatar
    Join Date
    Mar 2002
    Posts
    1,403
    Hi, could you explain these three lines:

    inregs.h.ah = 0; // set video mode sub-function
    inregs.h.al = (unsigned char)mode; // video mode to change to

    int86(0x10, &inregs, &outregs);


    i don't understand what i'm looking at, I can see that prior to the above lines a union was defined but whats the .h.ah stuff?

  4. #4
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,380
    >inregs.h.ah = 0; // set video mode sub-function
    >inregs.h.al = (unsigned char)mode; // video mode to change to

    Here the variables are put into the registers.

    Forgot to explain. The AL and AH are parts of register AX. If you don't know what I'm talking about, take a look at here

    http://www.technology.niagarac.on.ca.../assembler.htm

    >int86(0x10, &inregs, &outregs);

    Here the interrupt 10h is called with the required values in the registers passed.
    Last edited by Shiro; 04-01-2002 at 08:42 AM.

  5. #5
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    If you can use assembler in you code (TASM) you can do this:
    Code:
    void SetGraphicsMode()
    {
      asm mov ax, 0x13;
      asm int 0x10;
    }
    
    void SetTextMode()
    {
      asm mov ax, 0x03;
      asm int 0x10;
    }
    You MUST call SetTextMode when you exit your program, it might crash otherwise...
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  6. #6
    The Earth is not flat. Clyde's Avatar
    Join Date
    Mar 2002
    Posts
    1,403
    Thanks Shiro, are the int86() function and the "REGS" macro (from: "union REGS inregs,outregs;") defined in the dos.h header file?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Quick question about mode13h
    By Nutshell in forum Game Programming
    Replies: 6
    Last Post: 01-29-2003, 06:56 AM
  2. Mode13h
    By JoshG in forum Game Programming
    Replies: 3
    Last Post: 05-18-2002, 01:38 PM