Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ Language Reference - int86 http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
   int86

   Usage

   #include <dos.h>/* register structures */
   int int86(int intnum,union REGS *regsin, union REGS *regsout);

   Description
   This function performs an 8086 software interrupt where:

   intnum is the interrupt number (0..255).

   regsin  is  a  pointer to a structure containing  the  values  of  the
   registers AX, BX, CX, DX, SI and DI to be passed to the interrupt.
   regsout  is a pointer to a structure into which the return  values  of
   the registers will be written.

   The  REGS structure is defined in dos.h. Consult your system  hardware
   and  software manuals to determine what the interrupt numbers are  and
   what they do on your machine.

   Example
   /* These functions accept input from the keyboard and write the string
   to the screen via BIOS */

   #include <dos.h>
   #include <stdio.h>
   #define MAXKEY 19
   #define BEEP printf("\007")
   void print(void);
   void biosprt(void);
   char buf[MAXKEY],*ptr;
   int colm = 30,i;
   union REGS r;
   main()
   {
        system("cls");
        printf("Enter a 20 character string\n\n");
        gets(buf);
        if(strlen(buf)  > 20)
             printf("String to long, truncating\n");
        print();
        BEEP;
   }
   void print()
   {
        r.h.ah = 0x02;
        r.h.bh = 0;
        r.h.dh = 12;
        r.h.dl = colm;
        int86(0x10,&r,&r);
        for(ptr = buf,i = 0; i < = MAXKEY; (biosprt()),i++,ptr++);
   }

   void biosprt()
   {
        r.h.ah = 0x09;
        r.h.al = *ptr;
        r.x.cx = 1;
        r.h.bl = 0x0f;
        r.h.bh = 0;
        int86(0x10,&r,&r);
        r.h.ah = 0x02;
        r.h.bh = 0;
        r.h.dh = 12;
        r.h.dl = ++colm;
        int86(0x10,&r,&r);
   }

   Return Value
   int86  returns the value in the 8086 AX register at the completion  of
   the  interrupt.  The state of the carry flag can  be  determined  from
   x.cflag in regsout. Do not use int86 for interrupts 0x25 or 0x26.  Use
   dos_abs_disk_read / write for those.


See Also: int86x intdos bdos

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