        processor	16f84a
	radix		dec
	include		"p16f84a.inc"
	
	cblock		0x0c
			count1
			count2
	endc


	org		0x0
	goto		inic
	org		0x04
	
delay05	
	movlw		165
	movwf		count1
	decfsz		count1,f
	goto		$-1
	return
delay	
	movlw		80
	movwf		count2
	decfsz		count2,f
	goto		$-1
	return
stop	
	bcf		portb,6
	bcf		portb,7
	return
inic	
	bsf		status,5
	movlw		b'11111111'
	movwf		trisa
	movlw		b'00111111'
	movwf		trisb
	bcf		status,5
			
start	call		stop
	btfsc		portb,5
	goto		$-1
	btfss		portb,5
	goto		$-1
	btfsc		portb,5
	goto		$-1	
cakaj	
	call		delay05
testtl	
	btfsc		portb,5
	goto		start
	btfss		portb,3
	goto		vpred
	call		stop
	goto		cakaj
vpred	
	bsf		portb,6
	bsf		portb,7
	btfss		portb,2
	goto		testtl
	btfss		portb,1
	goto		vpravo
	btfss		portb,0
	goto		vlavo
	goto		start
vpravo	
	bcf		portb,7
	bsf		portb,6
	call		delay
	btfsc		portb,2
	goto		$-2
	goto		testtl
vlavo	
	bcf		portb,6
	bsf		portb,7
	call		delay
	btfsc		portb,2
	goto		$-2
	goto		testtl
	end
	