interrupt Keyword

The __interrupt keyword is a synonym for interrupt, which is allowed when using the -Ansi: Strict ANSI compiler option. See Non-ANSI Keywords in HC(S)08 Backend. One of two ways can be used to specify a function as an interrupt routine:

Use the non-standard interrupt keyword like any other type qualifier (as shown in the following listing). The keyword specifies a function as an interrupt routine. It is followed by a number specifying the entry in the interrupt vector that contains the address of the interrupt routine.

If the non-standard interrupt keyword is not followed by any number, the interrupt keyword functions the same as the TRAP_PROC pragma, specifying the function as an interrupt routine. However, you must associate the number of the interrupt vector with the name of the interrupt function by using the Linker's VECTOR directive in the Linker parameter file.

Listing: Examples of the Interrupt Keyword
interrupt void f(); // OK
// same as #pragma TRAP_PROC,

// please set the entry number in the prm-file

interrupt 2 int g();

// The 2nd entry (number 2) gets the address of func g().

interrupt 3 int g(); // OK

// third entry in vector points to g()

interrupt int l; // error: not a function