Assembly language program which uses the timer overflow interrupt
; Program to use the timer overflow interrupt
prog: equ $0800
data: equ $0900
int_vec: equ $0B10
TSCR: equ $0086
TMSK2: equ $008D
TFLG2: equ $008F
DDRA: equ $0002
PORTA: equ $0000
CODE: section .text ;The stuff which follows is program code
org prog ;set program counter to 0x0800
lds #$0A00 ;set the stack pointer
ldaa #$FF
staa DDRA ; Port A output
clr PORTA ; 0 -> Port A
ldaa #$80
staa TSCR ; Turn on timer
ldaa #$80
staa TMSK2 ; Enable timer overflow interrupt
ldaa #$80
staa TFLG2 ; Clear TOI flag
cli ; Enable interrupts
loop: bra loop ; Wait forever
toi_isr: inc PORTA ;
ldaa #$80
staa TFLG2 ; Clear TOI flag
rti
VEC: section .text ; Constant vectors
org int_vec
dc.w 0 ; BDLC
dc.w 0 ; ATD
dc.w 0 ; reserved
dc.w 0 ; SCI0
dc.w 0 ; SPI
dc.w 0 ; Pulse acc input
dc.w 0 ; Pulse acc overflow
dc.w toi_isr ; Timer overflow
dc.w 0 ; Timer channel 7
dc.w 0 ; Timer channel 6
dc.w 0 ; Timer channel 5
dc.w 0 ; Timer channel 4
dc.w 0 ; Timer channel 3
dc.w 0 ; Timer channel 2
dc.w 0 ; Timer channel 1
dc.w 0 ; Timer channel 0
dc.w 0 ; Real time
dc.w 0 ; IRQ
dc.w 0 ; XIRQ
dc.w 0 ; SWI
dc.w 0 ; illegal
dc.w 0 ; cop fail
dc.w 0 ; cop clock fail
dc.w $ff80 ; RESET