Thread: TC 3 error in void SetMCGA()

  1. #1
    Linux Forever
    Join Date
    Oct 2002
    Posts
    373

    TC 3 error in void SetMCGA()

    Dos MCGA graphics.... the only i MIGHT be able to do....

    Any way, heres the function:

    [code]
    #include <iostream.h>
    #include <conio.h>

    void SetMCVGA() {
    _AX = 0x0013;
    geninterrupt(0x10);
    }
    [/code

    the error say 'geninterrupt' should have prototype. What is wrong? thank you
    This war, like the next war, is a war to end war.

  2. #2
    Been here, done that.
    Join Date
    May 2003
    Posts
    1,164
    Yes, include dos.h. It's in Borland 1 and 5, so it must also be in 3. By the way, if anyone gets an error like this, simply go into the INCLUDE directory of your compiler and search for the offending function. That'll tell you which hearder needs to be included.
    Definition: Politics -- Latin, from
    poly meaning many and
    tics meaning blood sucking parasites
    -- Tom Smothers

  3. #3
    Linux Forever
    Join Date
    Oct 2002
    Posts
    373
    Oh, thank you guys!

    now, if only i can get this thing to go all the way with graphics, expect to see LOTS of dos games (Doom remakes in year 2050 when i find the source code LOL)
    This war, like the next war, is a war to end war.

  4. #4
    Linux Forever
    Join Date
    Oct 2002
    Posts
    373
    Oh, and, im using Turbo C++ 3.... i had it before, it was my first compiler, but i didn't like, i still dont like it, but if i can do graphics, ill love it
    This war, like the next war, is a war to end war.

  5. #5
    Linux Forever
    Join Date
    Oct 2002
    Posts
    373
    Okay... the turorial on the Cprogramming site here is a litle confusing....

    Code:
    memset(vga, Col, 0xffff);
    i can make Col 100, compiles that part, but it says 'vga' not declared.

    i set vga to the address it points to, but it get to errors of conversion or something like that....

    this is not good... i do not understand the tutorial all that much either, any other sites with tutorials, i would appreciate it. Thank you!

    Oh and what is that one site... brackeen, or brackster.... it had some tutorials on it....
    This war, like the next war, is a war to end war.

  6. #6
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    www.brackeen.com


    VGA must be a valid buffer or portion of memory. You might have to typecast it as well.

    Code:
    typedef unsigned char BYTE;
    
    BYTE far *VGA=(BYTE far *)MK_FP(0xa000,0);
    memset(VGA,0,length);
    
    BYTE far *buffer=new BYTE[64000L];
    memset(buffer,0,64000L);
    or

    Code:
    ...
    void CLS(BYTE far *buffer,BYTE color)
    {
       unsigned int buf=FP_SEG(buffer);
       asm {
         cld                  //just to be sure
         mov   ax,buf
         mov   es,ax
         mov   cx,32000d
         mov   al,color
         mov   ah,color
     
         rep     stosw
         }
    }
    
    int main(void)
    {
       asm { 
         mov ax,13h
         int 10h
       }
       BYTE far *Screen=(BYTE far *)MK_FP(0xa000,0);
       CLS(Screen,0);
       return(0);
    }
    Don't use geninterrupt() as it can leave the registers in unpredictable states. You are better off either using inline asm for interrupts or using the versatile int86() and int86x() functions.

    My function places x amount of words into the buffer instead of bytes which is a bit faster. If this were 32-bit you could use stosd which would be roughly twice as fast as this code.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Checking array for string
    By Ayreon in forum C Programming
    Replies: 87
    Last Post: 03-09-2009, 03:25 PM
  2. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 03:07 AM
  3. Case Statement
    By danlee58 in forum C Programming
    Replies: 16
    Last Post: 11-23-2008, 08:46 PM