Motorola HC12 User Manual

Page of 328
User’s Manual
MCUez HC12 Assembler
224
Operating Procedures
MOTOROLA
Operating Procedures
11.4  Initializing the Vector Table
The vector table is initialized in the assembly source file or in the linker
parameter file. Initializing it in the PRM file is recommended.
11.4.1  Initializing the Vector Table in the Linker PRM File
Initializing the vector table from the PRM (parameter) file allows initialization
of single entries in the table. The user can decide to initialize all the entries in
the vector table or not.
The labels or functions inserted in the vector table must also be implemented in
the assembly source file. All these labels must be published; otherwise, they
cannot be addressed in the linker PRM file.
Example:
XDEF IRQFunc, XIRQFunc, SWIFunc, OpCodeFunc, ResetFunc
DataSec: SECTION
Data:DS.W 5
; Each interrupt increments an element in the table
CodeSec: SECTION
; Implementation of the interrupt functions
IRQFunc:
LDAB #0
BRA  int
XIRQFunc:
LDAB #2
BRA  int
SWIFunc:
LDAB #4
BRA  int
OpCodeFunc:
LDAB #6
BRA  int
ResetFunc:
LDAB #8
BRA  entry
int:
LDX  #Data
; Load address of symbol Data in X
ABX
; X <- address of appropriate element in the table
INC  0, X
; The table element is incremented
RTI
entry:
LDS #$AFE
loop:
BRA loop