Borland C++ reference

intr

raw OCR

Alternate 8086 software interrupt interface.

Defined in header <dos.h>

Syntax

#include <dos.h>
void intriint intno, structREGPACK   *preg);
The intr function is an alternate interfacefor executing software

Portability

DOSUNIXWindowsANSI CC++ only
■■

Remarks

interrupts. It generates an 8086 software interrupt specified by the argument intno.

intr copies register values from the REGPACKstructure *preg into the

registers before executing the software interrupt. After the software interrupt completes, intr copies the current register values into *preg, including the flags.

The arguments passed to intr are as follows:

intno Interrupt number to be executed

pregAddress of a structure containing

(a) the input registers before the interrupt call (b) the value of the registers after the interrupt call

The REGPACKstructure (defined in dos.h) has the following format:

struct REGPACK { unsigned r_ax, r_bx, r_cx, r_dx; unsigned r_bp, r_si, r_di, r_ds, r_es, r_flags; };

Return value

No value is returned. The REGPACKstructure '^preg contains the value of

the registers after the interrupt call.

See also

Example

#include <stdio.h>
#include <string.h>
#include <dir.h>
#include <dos.h>
#define CF 1  /* Carry  flag */
int main (void)
{
   char directory [80];
   struct REGPACK reg;
   printf ("Enter directory to change to: ");
   gets (directory) ;
   reg.r_ax = 0x3B «  8;             /* shift 3Bh into  AH V
   reg.r_dx = FP_OFF (directory);
   reg.r_ds = FP_SEG (directory);
   intr(0x21, &reg) ;
   if (reg.r_flags & CF)
   printf ("Directory change failed\n");
getcwd (directory, 80);
printf ("The current directory is: %s\n"  directory)
return 0;

Differences from modern implementations

Nothing recorded yet.

Modern references

These are search links, not yet checked by hand.