beautypg.com

Motorola HC12 User Manual

Page 229

background image

Operating Procedures

Initializing the Vector Table

MCUez HC12 Assembler

User’s Manual

MOTOROLA

Operating Procedures

229

Example:

XDEF ResetFunc

DataSec: SECTION

Data: DS.W 5

; Each interrupt increments an element of 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

DummyFunc:

RTI

int:

LDX #Data

ABX

INC 0, X

RTI

entry:

LDS #$AFE

loop: BRA loop

ORG $FFF2

; Definition of the vector table in an absolute section

; starting at address $FFF2

IRQInt: DC.W IRQFunc

XIRQInt: DC.W XIRQFunc

SWIInt: DC.W SWIFunc

OpCodeInt: DC.W OpCodeFunc

COPResetInt: DC.W DummyFunc; No function attached

; to COP Reset

ClMonResInt: DC.W DummyFunc; No function attached to Clock

; MonitorReset

ResetInt : DC.W ResetFunc