	include <p18f4520.inc>

COUNT EQU 0x20

	ORG	0x00
	goto	init

	ORG	0x08		;interrupt vector
	incf	COUNT		;increment COUNT
	bcf	INTCON, 1	;clear the INT0 flag
	retfie			;return from interupt


init
	movlw	0x01
	movwf	TRISB		;portb bit 0 to input 
	movlw	0x00
	movwf	TRISC		;portc as output

	bsf	INTCON, 7	;enable global interrupts
	bsf	INTCON, 4	;enable INT0 on RB0
	bcf	INTCON, 1	;clear INT0 flag

	clrf	COUNT		;clear COUNT
	goto	main

main
	movf	COUNT, W
	movwf	PORTC		;move COUNT to PORTC

	goto	main

	END