User guide
40 DC 900-1338I
Protocol Software Toolkit Programmer Guide
When programming interrupt service routines in a high-level language, it is usually
necessary to provide an assembly language “shell” for the ISR in order to save certain
registers.
For example, the CrossCodeC compiler saves on entry and restores on exit all registers
used in a subroutine except D0, D1, A0, and A1, which are considered working regis-
ters. The calling code must save these registers, if necessary, before making a subroutine
call. These calling conventions, however, are not sufficient for ISRs. An ISR is not
“called” in the ordinary sense; it interrupts code that might currently be using the work-
ing registers. The ISR must, therefore, save those registers as well.
Because many compilers cannot distinguish between an ordinary subroutine and an
interrupt service routine, the programmer must provide an assembly language shell to
save the working registers on entry and restore them at completion of the ISR. (Note
that it is the address of the shell rather than the high-level language routine that must
be stored in the appropriate vector of the exception vector table.) Figure 2–1 shows a
sample assembly language shell.
Table 2–1: Vectors Reserved for System Software
Vector Number
(Decimal)
Vector Offset
(Hexadecimal) Function
25 64 Auto vector level 1
26 68 Auto vector level 2
27 6C Auto vector level 3
28 70 Auto vector level 4
32 80 TRAP # 0
33 84 TRAP # 1
34 88 TRAP # 2
35 8C TRAP # 3
36 90 TRAP # 4
37 94 TRAP # 5
47 BC TRAP # 15