Borland C++ reference

_dos_getvect

raw OCR

Gets interrupt vector.

Defined in header <dos.h>

Syntax

#include <dos.h>
void interrupt(*_dos_getvect(unsigned interruptno)) ();

Portability

DOSUNIXWindowsANSI CC++ only
■■

Remarks

Every processor of the 8086 family includes a set of interrupt vectors, numbered 0 to 255. The 4-byte value in each vector is actually an address, which is the location of an interrupt function.

_dos_getvect reads the value of the interrupt vector given by interruptno and returns that value as a (far) pointer to an interrupt function. The value of interruptno can be from 0 to 255.

Return value

_dos_getvect returns the current 4-byte value stored in the interrupt vector named by interruptno.

See also

Example

#include <stdio.h>
#include <dos.h>

#ifdef   cplusplus
    tdef ine _CPPARGS  . ..
#else
    Mefine  _CPPARGS
tendif
void interrupt get_out(  CPPARGS);     /* interrupt prototype */
void interrupt  (*oldfunc) (_CPPARGS)  /* interrupt function pointer */

int looping = 1;
int main (void)
{
  puts("Press <Shift><PrtSc> to terminate"
  /* save the old interrupt */
  oldfunc  = _dos_getvect (5);
  /* install interrupt handler */
  _dos_setvect(5,get_out);

  while (looping);  /* do nothing  */
  /* restore to original interrupt routine  */
  _dos_setvect(5,oldfunc);
  puts("Success");
  return 0;
}
void interrupt get_out ( CPPARGS)  {
  looping =0;    /* change global var to get  out of loop */
}

Differences from modern implementations

Nothing recorded yet.

Modern references

These are search links, not yet checked by hand.

Extraction notes

  • heading `_clos_getvect` read as `_dos_getvect`