Thread: Help Requested

  1. #1
    Registered User
    Join Date
    Dec 2003
    Posts
    4

    Help Requested

    I have the following function:

    extern void SetMode(int);
    #pragma aux SetMode ="int 10h"\
    parm [eax];

    I need to modify this function to call interrupt 0x10 with 0x4F02 in the AX register, and the mode number in the BX register. How would I modify it to do so? I use Open Watcom v1.1 and have limited knowledge regarding interrupts.

    If you were wondering, this is a function to set the video mode. Thus far, I can set it to 0x03 (text mode) and 0x13 (320x200x256colors). I need to set it to 0x111 (640x480x65,535 colors), but it needs the requested modification to do so.

    Your help is greatly appreciated.

  2. #2
    Registered User linuxdude's Avatar
    Join Date
    Mar 2003
    Location
    Louisiana
    Posts
    926
    I am almost positive you don't need the extern for your functions. For the rest I can't help you

  3. #3
    Registered User
    Join Date
    Nov 2001
    Posts
    38
    Can you not use the int86() function?

    From the Watcom help file:

    int86
    Synopsis:

    Code:
    #include <i86.h>
    int int86( int inter_no,
               const union REGS *in_regs,
               union REGS *out_regs );
    Description:

    The int86 function causes the computer's central processor (CPU) to be interrupted with an interrupt whose number is given by inter_no. Before the interrupt, the CPU registers are loaded from the structure located by in_regs. Following the interrupt, the structure located by out_regs is filled with the contents of the CPU registers. These structures may be located at the same location in memory.

    You should consult the technical documentation for the computer that you are using to determine the expected register contents before and after the interrupt in question.

    Returns:

    The int86 function returns the value of the CPU AX register after the interrupt.

    See Also:

    bdos, int386, int386x, int86x, intdos, intdosx, intr, segread

    Example:
    Code:
    /*
     * This example clears the screen on DOS
     */
    #include <i86.h>
    
    void main()
      {
        union REGS  regs;
    
        regs.w.cx = 0;
        regs.w.dx = 0x1850;
        regs.h.bh = 7;
        regs.w.ax = 0x0600;
    #if defined(__386__) && defined(__DOS__)
        int386( 0x10, &regs, &regs );
    #else
        int86( 0x10, &regs, &regs );
    #endif
      }
    Classification:

    Intel

    Systems:

    DOS/16, Windows, Win386, QNX/16, DOS/PM

  4. #4
    Registered User
    Join Date
    Dec 2003
    Posts
    4
    I thank you for your willingness to help. That helps me little, though. I need a function that does exactly what I listed above. If you have a modification for your listed function that will do the same or fairly similar, that could also be of help.

  5. #5
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Pure NASM:

    Code:
    [Section .TEXT]
    GLOBAL SetMode
    
    
    __SetMode:
    %define mode [ebp+8]
    mov  ax,04f02h
    mov  bx,[mode]
    int    10h
    ret

    Pure C:
    Code:
    #include <dos.h>
    
    
    void SetMode(int modenum)
    {
      REGS regs;
      regs.x.ax=0x4f02;
      regs.x.bx=modenum    //can change LFB bit here if u want
      int86(0x10,& regs,& regs);
    }

    For a listing of the interrupts in the system and some common uses for them - http://www-2.cs.cmu.edu/afs/cs/user/...WWW/files.html

  6. #6
    Registered User
    Join Date
    Dec 2003
    Posts
    4
    nm
    Last edited by heerojyuy; 12-22-2003 at 06:33 PM.

  7. #7
    Registered User
    Join Date
    Dec 2003
    Posts
    4
    thanks
    Last edited by heerojyuy; 12-22-2003 at 06:33 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Requested registry access is not allowed
    By arby220 in forum C# Programming
    Replies: 1
    Last Post: 06-24-2009, 12:57 AM
  2. Checking array for string
    By Ayreon in forum C Programming
    Replies: 87
    Last Post: 03-09-2009, 03:25 PM
  3. Advice requested, Code makes sense to me, not compiler
    By andrew.bolster in forum C Programming
    Replies: 53
    Last Post: 01-06-2008, 01:44 PM
  4. Suggestions requested on file handling
    By ss3x in forum C++ Programming
    Replies: 0
    Last Post: 02-21-2002, 10:42 PM