**********************************************************************
* IRQ Interrupt Example          EEL-4744        EMS & AAA *
**********************************************************************
* EQUATEs
**********************************************************************
RAM	EQU	$0000
RAMEND	EQU	$01FF
IPV_IRQ	EQU	$00EE
EEPROM	EQU	$B600
PORTB	EQU	$1004
**********************************************************************
* Data Section
**********************************************************************
	ORG	RAM
CNTR8	RMB	1	; Could use ZMB 1 or FCB 0
**********************************************************************
* Interrupt Pseudo-Vector Initialization (to run on EVBU)
**********************************************************************
	ORG	IPV_IRQ	
	JMP	IRQ_ISR
**********************************************************************
* Main Program
**********************************************************************
	ORG	EEPROM
**********************************************************************
* Initialization Section
**********************************************************************
	LDS	#RAMEND	; Initialize the stack pointer, SP
	CLR	CNTR8	; Take the responsibility for clearing counter
**********************************************************************
* Setup each hardware device
**********************************************************************
*	Initialize the IRQ FF to zero using the Pre-Clear input on PB0
	LDAA	#%00000000	; We could have used CLRA or CLR PORTB
	STAA	PORTB		; Set PB0=0, i.e., pre-clear the FF
	LDAA	#%00000001  ; Turn off pre-clear input; could use INCA
	STAA	PORTB		; FF ready for switch depression
**********************************************************************
* Main program does its work here
**********************************************************************
	CLI			; Turn interrupt system on
HERE	BRA	HERE		; Main program waits on interrupts
*
**********************************************************************
* Interrupt Service Routine(s)
**********************************************************************
*	Part I : Service the interrupt
**********************************************************************
IRQ_ISR	INC	CNTR8		; Count up each switch depression
**********************************************************************
*	Part II : Clear the interrupt flag
**********************************************************************
	LDAA	#%00000000	; Turn off PB0 to pre-clear the FF
	STAA	PORTB		;   ...
	LDAA	#%00000001 	; Turn off pre-clear input; could use INCA
	STAA	PORTB		; FF ready for next switch depression
	RTI			; Return from Interrupt Service
