		processor		16f84a
		radix			dec
		include		"p16f84a.inc"
	
		cblock		0x0c
					wtemp
					statustemp
					numbertemp
					numint
					wait
		endc

#define	_z			status,z
#define	_c			status,c
#define	_rp0			status,rp0

		org			0x0
		goto			inic
		org			0x4
		goto			int

int
		movwf		wtemp
		swapf		status,w
		bcf		_rp0
		movwf		statustemp
		bcf		intcon,t0if
		incf		numint,f
		movf		numint,w
		sublw		244
		btfsc		status,z
		goto		delete
		swapf		status,w
		movwf		status
		swapf		wtemp,f
		swapf		wtemp,w
		retfie
delete
		movlw		144
		movwf		wait
		nop
		decfsz	wait,f
		goto		$-2		
		clrf		numint
		incf		numbertemp,f
		movf		numbertemp,w
		sublw		10
		btfsc		_z
		clrf		numbertemp
		return
	
TABLE
		addwf 	PCL,F     ;add to PCL
        	retlw 	B'11111100' ;0  seven segment codes
       	retlw 	B'01100000' ;1
        	retlw 	B'11011010' ;2
        	retlw 	B'11110010' ;3
        	retlw 	B'01100110' ;4
        	retlw 	B'10110110' ;5
        	retlw 	B'10111110' ;6
        	retlw 	B'11100000' ;7
        	retlw 	B'11111110' ;8
        	retlw 	B'11110110' ;9
inic
		bsf		status,rp0
		movlw		b'11111111'
		movwf		trisa
		clrf		trisb
		bcf		status,rp0
		movlw		b'11000011'
		movwf		option_reg
		bsf		intcon,gie
		bsf		intcon,t0ie

start
		movf		numbertemp,w
		call		table
		movwf		portb
		goto		start
		end
