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++ 3.0r4 - <b>int86</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
int86
intreal
   Note-These functions are not available under OS/2.

Usage

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

Description

   int86() performs a 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.

   intreal() is only available in the X and P memory models. See below for
   an explanation.

Special Consideration for the X and P Memory Models

   In the X and P memory models, the functions bdos(), bdosx(), int86(),
   int86x(), intdos(), and intdosx() employ some filtering of parameters
   sent to the real mode interrupt. For example if DOS function 40h (write)
   is detected, the source buffer is copied to a buffer in conventional
   memory (dos-buffer) and a pointer to dos-buffer is passed to DOS since
   DOS could not properly use the buffer located in extended memory.  If the
   information passed is larger than dos-buffer, there are multiple calls to
   DOS to transfer all information, which may be much larger than 64k.

   Where pointers are passed to these functions, they are assumed to contain
   protected mode addresses. The filtering routine used for these functions
   assumes that all far pointers passed in registers to DOS have a segment
   address of DGROUP. If you use int86x() to execute int 21h and specify
   selectors other than DGROUP, the results will be unpredictable. It is
   possible to bypass this filtering by using the function int_real()
   instead of int86(). This function bypasses all protected mode filtering
   in both the Phar Lap and DOSX extenders and executes the interrupt in
   real mode.  It can be used to retrieve real mode segment values from the
   BIOS or from DOS if desired.

   Under the X memory model, not all DOS calls are supported in the
   filtering process. DOS calls (listed in hex) that are completely
   supported include:

   0 - 9

   b, d, e, 19

   2a - 2e

   30, 33, 36

   39 - 43

   45 - 47

   4c - 4f

   54 - 58

   5b - 5c

   62
   returns protected mode selector, not real mode
   segment

   63

   66 - 68



   Partial support:

   c
   AL = 0, AH not supported

   1a
   DTA set to a location in conventional memory

   2f
   Get DTA returns protected mode address of DTA in
   conventional memory

   44
   Subfunctions 2, 3, 4, 5, c and d are not supported

   59
   Information at ES:DI not available

   5a
   Information at ds:dx is not available

   Functions not supported:

   a

   f - 17

   1b - 1c

   21 - 29

   2f

   31

   35

   38

   48 - 4b

   5e - 5f

   65

   Some of the functions which are not currently supported will be supported
   in future versions of the DOSX 386 memory model. Refer to your Phar Lap
   documentation for information about supported DOS functions in the P
   memory model.

Example 

   /*
           These functions accept input from the keyboard and write
           the string to the screen via BIOS
   */
   #include <dos.h>

   #include <stdio.h>
   #include <stdlib.h>
   #include <string.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;

   int main()
   {
       system("cls");
       printf("Enter a 20 character string\n\n\n");
       gets(buf);
       if (strlen(buf)  > 20)
           printf("String to long, truncating\n");
       print();

       BEEP;
       return EXIT_SUCCESS;
   }

   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 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




See Also: int86x intdos bdos

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