Crossware

Table of Contents        Previous topic       Next topic       

COMPILER LIBRARY FUNCTIONS->Detailed Descriptions->_getvect()

Summary


#include <os.h>

void *_getvect(unsigned int n);    Get the interrupt handler


Parameter

n        Address of interrupt vector



Description

There are two versions of this function.  One for the 68000 and one for the CPU32 and 68020.

For the 68000, the routine assumes that address n contains a long JMP instruction to an interrupt handler.  It reads the four bytes following the 2 byte JMP opcode and returns these cast to a void pointer.  This void pointer therefore represents a pointer to the interrupt handler function.  

For the CPU32 and 68020 the use of a jump table is unnecessary since the chips provide the Vector Base Regsiter (VBR) to allow the vector table to be relocated.  Therefore the function reads the four bytes at address n and returns these cast to a void pointer.  This void pointer therefore represents a pointer to the interrupt handler function.  

Typically this function would be called prior to a _setvect() call to save the address of the interrupt handler before it is overwritten by _setvect().  

Header file os.h contains prototypes for _getvect() and _setvect().  Header file os.h also contains the vector numbers for the 680X0 and these can be used in conjunction with the _X_VO predefined macro to calculate the value of n at compile time.


Return Value

Address of the interrupt handler cast to a void pointer.