* For Xtal= 8 Mhz, initialization sequence and the interrupt routine 
* to generate a 500 Hz clock on PA5.

* INITIALIZATION
ITOC3	BSET	DDRA,$20	;PA5 output
	LDAA	#$10		;[OM3:OL3]=[0:1]
	STAA	TCTL1		;toggle output selected
	BSET	TFLG1,$20	;clear IC3F if any
	BSET	TMSK1,$20	;enable TOC3 interrupts
	RTS

* INTERRUPT SERVICE ROUTINE

TOC3SVC	BSET	TFLG1,$20	;clear OC3F
	LDD	TOC3		;get current value of TOC3
	ADDD	#4000		;add 4000 - 2 ms more
	STD	TOC3		;update TOC3
	RTI			;return from interrupt
