Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C Library Reference - <u>synopsis:</u> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <dos.h>
    int intdosx( const union REGS *in_regs,
                 union REGS *out_regs,
                 struct SREGS *seg_regs );

Description:
    The intdosx function causes the computer's central processor (CPU) to be
    interrupted with an interrupt number hexadecimal 21 (0x21), which is a
    request to invoke a specific DOS function.  Before the interrupt, the
    CPU registers are loaded from the structure located by in_regs and the
    segment registers DS and ES are loaded from the structure located by
    seg_regs.  The AH register contains a number indicating the function
    requested.  All of the segment registers must contain valid values.
     Failure to do so will cause a segment violation when running in protect
    mode.  If you don't care about a particular segment register, then it
    can be set to 0 which will not cause a segment violation.  The function
    segread can be used to initialize seg_regs to their current values.

    Following the interrupt, the structure located by out_regs is filled
    with the contents of the CPU registers.  The in_regs and out_regs
    structures may be located at the same location in memory.  The original
    values for the DS and ES registers are restored.  The structure seg_regs
    is updated with the values of the segment registers following the
    interrupt.

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

Returns:
    The intdosx function returns the value of the AX (EAX in 32-bit library)
    register after the interrupt has completed.  The CARRY flag (when set,
    an error has occurred) is copied into the structure located by out_regs.
     When an error has occurred,  errno contains a value indicating the type
    of error that has been detected.

Example:
    #include <stdio.h>
    #include <dos.h>

    /* get current mouse interrupt handler address */

    void main()
      {
        union REGS r;
        struct SREGS s;

    #if defined(__386__)
        s.ds = s.es = s.fs = s.gs = FP_SEG( &s );
    #endif
        r.h.ah = 0x35;  /* get vector */
        r.h.al = 0x33;  /* vector 0x33 */
        intdosx( &r, &r, &s );
    #if defined(__386__)
        printf( "mouse handler address=%4.4x:%lx\n",
                s.es, r.x.ebx );
    #else
        printf( "mouse handler address=%4.4x:%4.4x\n",
                s.es, r.x.bx );
    #endif
      }

Classification:
    DOS

Systems:
    DOS, Windows, Win386, DOS/PM

See Also:
    bdos, int386, int386x, int86, int86x, intdos, intr, segread

See Also: bdos int386

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson