Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Borland C++ 2.x ( with Turbo C ) - <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 0x21) 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.
                    If the 'cflag' field in 'outregs' is non-zero, an
                    error has occurred and '_doserrno' (defined in
                    <errno.h>) is set to the error code.

         Notes:     intdos() is intended to invoke DOS system calls that
                    expect arguments in registers other than DX or AL, or
                    that indicate errors by setting the carry flag.
                    Services that use only DX and AL and don't use the
                    carry flag, can be invoked via the bdos() or
                    bdosptr() function.

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

   Portability:     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 func 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