problem

This is a discussion on problem within the C Programming forums, part of the General Programming Boards category; i have this code: Code: #include <stdio.h> #include <bios.h> void StandardVideoMode(int mode) { asm{move ax,mode int 10h } } int ...

  1. #1
    Unregistered
    Guest

    problem

    i have this code:

    Code:
    #include <stdio.h>
    #include <bios.h>
    
    void StandardVideoMode(int mode)
    {
    	asm{move ax,mode
    		int 10h
    	}
    }
    
    int main()
    {
    	StandardVideoMode(19);
    	return 0;
    }
    im trying to get to videomode (im starting to learn some graphics programming)

    and it gives me the following:
    >>
    gra.c: In function 'StandardVideoMode':
    gra.c:6: parse error before '{' token
    gra.c:7: invalid suffix on integer constant
    <<

    what to do ?

    my compiler is djgpp(2.3 ?)/gcc

  2. #2
    MrWizard
    Guest
    Do you mean 10 hexadecimal? In c++ this is notated not with the "h" but instead with a 0x prefix. So try A as that is the hexadecimal equivalent to 10.

  3. #3
    Green Member Cshot's Avatar
    Join Date
    Jun 2002
    Posts
    892
    Code:
    asm{move ax,mode int 10h}
    Try using parantheses
    Code:
    asm{move ax,mode int 10h}
    Try not.
    Do or do not.
    There is no try.

    - Master Yoda

  4. #4
    Casual Visitor
    Join Date
    Oct 2001
    Posts
    350
    Try it this way, though it may be compiler specific. I've had more success in using shorts than chars

    Code:
    unsigned char mode;
    /*  or */
    short mode;
    
    
    _asm
    {
          mov ah,00h   ; set mode function
          mov al,mode ;  your desired mode with char
          ;
          mov al,byte ptr mode ; your desired mode with short 
          int 10h
    }
    I doubt that this will work with a 32 bit compiler. You'll need something that creates 16 bit apps for dos.
    I haven't used a compiler in ages, so please be gentle as I try to reacclimate myself. :P

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help understanding a problem
    By dnguyen1022 in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2009, 04:21 PM
  2. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 10:22 AM
  3. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  4. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  5. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM

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