Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Microsoft C 6.0 - <b>intdos() invoke dos function, long form</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 intdos()                Invoke DOS Function, Long Form

 #include   <dos.h>

 int          intdos(inregs,outregs);
 union REGS   *inregs;                   Register values going into call
 union REGS   *outregs;                  Register values on return

    intdos() invokes a DOS system call (Interrupt 21h) after setting the
    registers to the values in 'inregs'.  'outregs' is set to the value
    of the registers after the system call.  The 'cflag' field of
    'outregs' is set to the status of the system carry flag; a non-zero
    value indicates a DOS error. 'inregs.h.ah' is the DOS function
    number. (The union REGS is defined in dos.h.)

    Returns:    The value of the AX register after the system call. On
                error, the 'cflag' field in 'outregs' is non-zero, and
                '_doserrno' (defined in <stdlib.h>) is set to the error
                code.

      Notes:    Use intdos() to invoke DOS system calls that either
                expect arguments in registers other than DX or AL, or
                that set the carry flag on error. Services that use only
                DX and AL and don't use the carry flag, can be invoked
                via the bdos() function.

                If 'far' or 'huge' addresses are passed to DOS, you may
                need to use intdosx() instead of intdos().

 Portability:   Applies to MS DOS only.

   ------------------------------- Example ------------------------------

    The following statements print statistics about disk usage for drive
    A:.

           #include <dos.h>            /* for intdos() and union REGS */
           #include <stdio.h>          /* for printf() */

           union REGS inregs, outregs;

           main()
           {
               inregs.h.ah = 0x36;  /* get disk free space function number*/
               inregs.h.dl = 1;       /* drive A: */
               intdos(&inregs, &outregs);
               printf("%d sectors/cluster, %d clusters,
                       %d bytes/sector, %d total clusters",
                       outregs.x.ax, outregs.x.bx, outregs.x.cx,
                       outregs.x.dx);
           }


See Also: bdos() intdosx() int86()

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