LIST P=16F873

#INCLUDE "P16F873.INC"

__CONFIG _XT_OSC&_CP_OFF&_WDT_OFF&_LVP_OFF&_PWRTE_ON&_BODEN_ON

	CBLOCK 0x21

	T1			
	T2			
	T3			
	T4			
	ADADAT1			
	ADADAT2			
	TAROLO			 
	OSSZEHASONLIT	
	NYOLCBIT		
	OSZLOP			
	OT				
	OE				
	PT				
	PE				
	MST				
	MSE				
	SZAM			
	IDOZIT0		
	IDOZIT1			
	WSAVE
	MASODPERCE		
	MASODPERCT		
	PERCE			
	PERCT
	ORAE
	ORAT
	EJFEL			
	XX1				
	XX2				
	XX1SZAML		
	XX2SZAML		
	TIPUS				
	TIPUSKESLELTETES	
	KERETSZAML		
	LEDVILLOG	
	
	ENDC

	ORG		0
	GOTO		START		
	
	ORG		4				
	
	MOVWF		WSAVE		
	
	MOVLW		B'11010011'	
	MOVWF		TMR1L
	MOVLW		B'00001011'
	MOVWF		TMR1H
	
	BTFSC		PIR1,TMR1IF	
	GOTO		TIMEREGY	 
						
	BTFSC		INTCON,T0IF
	GOTO		TIMERNULLA
	
	BTFSC		INTCON,RBIF	
	GOTO		RBMEGSZ

TIMEREGY:
	
	BCF		PIR1,TMR1IF		
		
	DECFSZ		IDOZIT1
	GOTO		IDOZITVEGE
	
	MOVLW		.10
	MOVWF		IDOZIT1

	INCF		LEDVILLOG
	INCF		MASODPERCE		

MASODPERCE1:			
	MOVF		MASODPERCE,W		
	XORLW		.1	
	BTFSS		STATUS,Z
	GOTO		MASODPERCE2	
	MOVLW		.1
	MOVWF		MSE
	RETFIE	
	
MASODPERCE2:			
	MOVF		MASODPERCE,W		
	XORLW		.2	
	BTFSS		STATUS,Z
	GOTO		MASODPERCE3	
	MOVLW		.2
	MOVWF		MSE
	RETFIE		
	
MASODPERCE3:			
	MOVF		MASODPERCE,W		
	XORLW		.3	
	BTFSS		STATUS,Z
	GOTO		MASODPERCE4	
	MOVLW		.3
	MOVWF		MSE
	RETFIE		
	
MASODPERCE4:			
	MOVF		MASODPERCE,W		
	XORLW		.4	
	BTFSS		STATUS,Z
	GOTO		MASODPERCE5	
	MOVLW		.4
	MOVWF		MSE
	RETFIE		
	
MASODPERCE5:			
	MOVF		MASODPERCE,W		
	XORLW		.5	
	BTFSS		STATUS,Z
	GOTO		MASODPERCE6	
	MOVLW		.5
	MOVWF		MSE
	RETFIE		
	
MASODPERCE6:			
	MOVF		MASODPERCE,W		
	XORLW		.6	
	BTFSS		STATUS,Z
	GOTO		MASODPERCE7	
	MOVLW		.6
	MOVWF		MSE
	RETFIE		
	
MASODPERCE7:			
	MOVF		MASODPERCE,W		
	XORLW		.7	
	BTFSS		STATUS,Z
	GOTO		MASODPERCE8	
	MOVLW		.7
	MOVWF		MSE
	RETFIE		
	
MASODPERCE8:			
	MOVF		MASODPERCE,W		
	XORLW		.8	
	BTFSS		STATUS,Z
	GOTO		MASODPERCE9	
	MOVLW		.8
	MOVWF		MSE
	RETFIE		
	
MASODPERCE9:			
	MOVF		MASODPERCE,W		
	XORLW		.9	
	BTFSS		STATUS,Z
	GOTO		MASODPERCT1	
	MOVLW		.9
	MOVWF		MSE
	RETFIE		

MASODPERCT1:

	CLRF		MASODPERCE
	CLRF		MSE
	INCF		MASODPERCT

	MOVF		MASODPERCT,W		
	XORLW		.1	
	BTFSS		STATUS,Z
	GOTO		MASODPERCT2	
	MOVLW		.1
	MOVWF		MST
	RETFIE	
	
MASODPERCT2:
	MOVF		MASODPERCT,W		
	XORLW		.2	
	BTFSS		STATUS,Z
	GOTO		MASODPERCT3	
	MOVLW		.2
	MOVWF		MST
	RETFIE			
	
MASODPERCT3:
	MOVF		MASODPERCT,W		
	XORLW		.3	
	BTFSS		STATUS,Z
	GOTO		MASODPERCT4	
	MOVLW		.3
	MOVWF		MST
	RETFIE	
	
MASODPERCT4:
	MOVF		MASODPERCT,W		
	XORLW		.4	
	BTFSS		STATUS,Z
	GOTO		MASODPERCT5	
	MOVLW		.4
	MOVWF		MST
	RETFIE	
	
MASODPERCT5:
	MOVF		MASODPERCT,W		
	XORLW		.5	
	BTFSS		STATUS,Z
	GOTO		PERCE1	
	MOVLW		.5
	MOVWF		MST
	RETFIE	
	
PERCE1:

	CLRF		MASODPERCT
	CLRF		MST
	INCF		PERCE
	
	MOVF		PERCE,W		
	XORLW		.1	
	BTFSS		STATUS,Z
	GOTO		PERCE2	
	MOVLW		.1
	MOVWF		PE
	RETFIE		
	
PERCE2:
	MOVF		PERCE,W		
	XORLW		.2	
	BTFSS		STATUS,Z
	GOTO		PERCE3	
	MOVLW		.2
	MOVWF		PE
	RETFIE	

PERCE3:	
	MOVF		PERCE,W		
	XORLW		.3	
	BTFSS		STATUS,Z
	GOTO		PERCE4	
	MOVLW		.3
	MOVWF		PE
	RETFIE		
	
PERCE4:	
	MOVF		PERCE,W		
	XORLW		.4	
	BTFSS		STATUS,Z
	GOTO		PERCE5	
	MOVLW		.4
	MOVWF		PE
	RETFIE	
	
PERCE5:	
	MOVF		PERCE,W		
	XORLW		.5	
	BTFSS		STATUS,Z
	GOTO		PERCE6	
	MOVLW		.5
	MOVWF		PE
	RETFIE	
	
PERCE6:	
	MOVF		PERCE,W		
	XORLW		.6	
	BTFSS		STATUS,Z
	GOTO		PERCE7	
	MOVLW		.6
	MOVWF		PE
	RETFIE	
	
PERCE7:	
	MOVF		PERCE,W		
	XORLW		.7	
	BTFSS		STATUS,Z
	GOTO		PERCE8	
	MOVLW		.7
	MOVWF		PE
	RETFIE	
	
PERCE8:	
	MOVF		PERCE,W		
	XORLW		.8	
	BTFSS		STATUS,Z
	GOTO		PERCE9	
	MOVLW		.8
	MOVWF		PE
	RETFIE	

PERCE9	
	MOVF		PERCE,W		
	XORLW		.9	
	BTFSS		STATUS,Z
	GOTO		PERCT1	
	MOVLW		.9
	MOVWF		PE
	RETFIE	
	
PERCT1:

	CLRF		PERCE
	CLRF		PE
	INCF		PERCT
	
	MOVF		PERCT,W		
	XORLW		.1	
	BTFSS		STATUS,Z
	GOTO		PERCT2	
	MOVLW		.1
	MOVWF		PT
	RETFIE	

PERCT2:
	MOVF		PERCT,W		
	XORLW		.2	
	BTFSS		STATUS,Z
	GOTO		PERCT3	
	MOVLW		.2
	MOVWF		PT
	RETFIE

PERCT3:
	MOVF		PERCT,W		
	XORLW		.3	
	BTFSS		STATUS,Z
	GOTO		PERCT4	
	MOVLW		.3
	MOVWF		PT	
	RETFIE

PERCT4:
	MOVF		PERCT,W		
	XORLW		.4	
	BTFSS		STATUS,Z
	GOTO		PERCT5	
	MOVLW		.4
	MOVWF		PT
	RETFIE	

PERCT5:
	MOVF		PERCT,W		
	XORLW		.5	
	BTFSS		STATUS,Z
	GOTO		ORAE1	
	MOVLW		.5
	MOVWF		PT
	RETFIE

ORAE1:
	
	CLRF		PERCT
	CLRF		PT
	INCF		ORAE
	
	MOVF		ORAE,W		
	XORLW		.1	
	BTFSS		STATUS,Z
	GOTO		ORAE2	
	MOVLW		.1
	MOVWF		OE
	RETFIE
	
ORAE2:
	MOVF		ORAE,W		
	XORLW		.2	
	BTFSS		STATUS,Z
	GOTO		ORAE3	
	MOVLW		.2
	MOVWF		OE
	RETFIE	

ORAE3:
	MOVF		ORAE,W		
	XORLW		.3	
	BTFSS		STATUS,Z
	GOTO		ORAE4	
	MOVLW		.3
	MOVWF		OE
	RETFIE

ORAE4:
	MOVF		ORAE,W		
	XORLW		.4	
	BTFSS		STATUS,Z
	GOTO		ORAE5	
	MOVLW		.4
	MOVWF		OE
	
	MOVF		EJFEL,W
	XORLW		.1
	BTFSS		STATUS,Z
	RETFIE
	GOTO		THEEND
	
	RETFIE

ORAE5:
	MOVF		ORAE,W		
	XORLW		.5	
	BTFSS		STATUS,Z
	GOTO		ORAE6	
	MOVLW		.5
	MOVWF		OE
	RETFIE

ORAE6:
	MOVF		ORAE,W		
	XORLW		.6	
	BTFSS		STATUS,Z
	GOTO		ORAE7	
	MOVLW		.6
	MOVWF		OE
	RETFIE

ORAE7:
	MOVF		ORAE,W		
	XORLW		.7	
	BTFSS		STATUS,Z
	GOTO		ORAE8	
	MOVLW		.7
	MOVWF		OE
	RETFIE	
	
ORAE8:
	MOVF		ORAE,W		
	XORLW		.8	
	BTFSS		STATUS,Z
	GOTO		ORAE9	
	MOVLW		.8
	MOVWF		OE
	RETFIE	
	
ORAE9:
	MOVF		ORAE,W		
	XORLW		.9	
	BTFSS		STATUS,Z
	GOTO		ORAT1	
	MOVLW		.9
	MOVWF		OE
	RETFIE	
	
ORAT1:

	CLRF		ORAE
	CLRF		OE
	INCF		ORAT	
	
	MOVF		ORAT,W		
	XORLW		.1	
	BTFSS		STATUS,Z
	GOTO		ORAT2	
	MOVLW		.1
	MOVWF		OT
	RETFIE	
	
ORAT2:
	MOVF		ORAT,W		
	XORLW		.2	
	BTFSS		STATUS,Z
	GOTO		THEEND	
	MOVLW		.2
	MOVWF		OT
	
	MOVLW		.1
	MOVWF		EJFEL
	
	RETFIE	
	
THEEND:
	CLRF		ORAE
	CLRF		OE
	
	CLRF		ORAT
	CLRF		OT
	
	CLRF		EJFEL
	
	RETFIE

IDOZITVEGE:
	MOVF		WSAVE,W			
	RETFIE

TIMERNULLA:					
							
	BCF		PORTC,7			
	BCF		PORTC,6
	BCF		PORTC,5
	BCF		PORTC,4
	
	BCF		INTCON,T0IF

	DECFSZ		IDOZIT0
	RETFIE

	MOVLW		.20
	MOVWF		IDOZIT0
	
	BSF		INTCON,RBIE		
	
	BTFSS		PORTB,7			
	GOTO		RBMEGSZ			
	BTFSS		PORTB,6			
	GOTO		RBMEGSZ
	BTFSS		PORTB,5			
	GOTO		RBMEGSZ
	BTFSS		PORTB,4			
	GOTO		RBMEGSZ
	
	BCF		INTCON,T0IE		
	CLRF		TMR0
	MOVLW		.10
	MOVWF		IDOZIT1
	BSF		T1CON,TMR1ON	
	MOVLW		B'11010011'
	MOVWF		TMR1L
	MOVLW		B'00001011'
	MOVWF		TMR1H			
	
	RETFIE

RBMEGSZ:

	BCF		INTCON,RBIE		
	
	BCF		T1CON,TMR1ON

	BCF		INTCON,RBIF
	
	BSF		INTCON,T0IE		
	
	MOVLW		.5				
	MOVWF		LEDVILLOG		
	
GOMBORAT:
	BTFSC		PORTB,4			
	GOTO		GOMBORAE
	
	BSF		PORTC,4			
	
	INCF		OT
	INCF		ORAT
	
	MOVF		ORAT,W			
	XORLW		.2			
	BTFSS		STATUS,Z
	GOTO		NORMALORAT
	
	MOVLW		.1
	MOVWF		EJFEL
	
	MOVF		ORAE,W			
	SUBLW		.3			
	BTFSC		STATUS,C		
	GOTO		NORMALORAT
	
	CLRF		ORAE
	CLRF		OE
	
NORMALORAT:
	MOVF		ORAT,W
	XORLW		.3
	BTFSS		STATUS,Z
	GOTO		RBVEGE
	CLRF		ORAT
	CLRF		OT
	GOTO		RBVEGE
	
GOMBORAE:
	BTFSC		PORTB,5
	GOTO		GOMBPERCT
	
	BSF		PORTC,5
	
	INCF		OE
	INCF		ORAE
	
	MOVF		ORAT,W		
	XORLW		.2
	BTFSS		STATUS,Z
	GOTO		NORMAL
		
	MOVF		ORAE,W
	XORLW		.4
	BTFSS		STATUS,Z
	GOTO		RBVEGE
	CLRF		ORAE
	CLRF		OE
	GOTO		RBVEGE
	
NORMAL:
	MOVF		ORAE,W
	XORLW		.10
	BTFSS		STATUS,Z
	GOTO		RBVEGE
	CLRF		ORAE
	CLRF		OE
	GOTO		RBVEGE

GOMBPERCT:
	BTFSC		PORTB,6
	GOTO		GOMBPERCE
	
	BSF		PORTC,6
	
	INCF		PT
	INCF		PERCT
	MOVF		PERCT,W
	XORLW		.6
	BTFSS		STATUS,Z
	GOTO		RBVEGE
	CLRF		PERCT
	CLRF		PT
	GOTO		RBVEGE

GOMBPERCE:	
	BTFSC		PORTB,7
	GOTO		RBVEGE
	
	BSF		PORTC,7
	
	INCF		PE
	INCF		PERCE
	MOVF		PERCE,W
	XORLW		.10
	BTFSS		STATUS,Z
	GOTO		RBVEGE
	CLRF		PERCE
	CLRF		PE
	GOTO		RBVEGE
	
RBVEGE:

	CLRF		MASODPERCE
	CLRF		MASODPERCT
	CLRF		MSE
	CLRF		MST

	CALL		DELAY		

	MOVF		WSAVE,W
	
	RETFIE
	
START	
	BSF		STATUS,RP0 ;BANK1
	MOVLW		B'00000000'
	MOVWF		TRISA
	MOVLW		B'11111000'
	MOVWF		TRISB
	MOVLW		B'00000000'
	MOVWF		TRISC
	MOVLW		B'00000111'		
	MOVWF		OPTION_REG
	BSF		PIE1,TMR1IE		
	BCF		STATUS,RP0 ;BANK0
	
	MOVLW		B'00110100'		
	MOVWF		T1CON
	
	CLRF		PORTC
	BSF		PORTC,7			
	CALL		DELAY2
	CALL		DELAY2
	BSF		PORTC,6
	CALL		DELAY2
	CALL		DELAY2
	BSF		PORTC,5
	CALL		DELAY2
	CALL		DELAY2
	BSF		PORTC,4
	CALL		DELAY2
	CALL		DELAY2
	CLRF		PORTC
	
	CLRF		PORTC
	
	CLRF		PORTB
	BSF		PORTB,0				
	CLRF		NYOLCBIT
	
	CLRF		OT
	CLRF		OE
	CLRF		PT
	CLRF		PE
	CLRF		MST
	CLRF		MSE
	
	MOVLW		.20
	MOVWF		IDOZIT0
	MOVLW		.10
	MOVWF		IDOZIT1
	
	CLRF		MASODPERCE
	CLRF		MASODPERCT
	CLRF		PERCE
	CLRF		PERCT
	CLRF		ORAE
	CLRF		ORAT
	
	CLRF		EJFEL
	
	CLRF		LEDVILLOG
	
	MOVLW		.1
	MOVWF		TIPUS
	CLRF		TIPUSKESLELTETES
	
	CLRF		KERETSZAML
	
	CALL		BEALLITAS		
	
	CLRF		TIPUSKESLELTETES
	CLRF		PORTC
	
	BCF		INTCON,RBIF		
	BSF		INTCON,RBIE		
	
	BSF		INTCON,GIE		
	BCF		INTCON,T0IE		
	BSF		T1CON,TMR1ON	
	BSF		INTCON,PEIE		
	CLRF		TMR0
	MOVLW		B'11010011'		
	MOVWF		TMR1L
	MOVLW		B'00001011'
	MOVWF		TMR1H
		
FOPROGRAM:

	MOVF		KERETSZAML,W	
	XORLW		.50				
	BTFSS		STATUS,Z		
	INCF		KERETSZAML		
	MOVF		KERETSZAML,W
	XORLW		.50
	BTFSS		STATUS,Z
	GOTO		KEZDES
	CALL		TIPUSVAL	
	
KEZDES:

	CALL		LEDVILLOGTATAS		

	MOVLW		.0		
	MOVWF		XX1			
	MOVLW		.1
	MOVWF		XX1SZAML
	MOVLW		B'10000000'
	MOVWF		XX2
	MOVLW		.0
	MOVWF		XX2SZAML
	MOVF		OT,W		
	MOVWF		SZAM
	CALL		KIJELZES
	
	MOVLW		.3
	MOVWF		XX1
	MOVLW		.1
	MOVWF		XX1SZAML
	MOVLW		B'10000000'
	MOVWF		XX2
	MOVLW		.0
	MOVWF		XX2SZAML
	MOVF		OE,W
	MOVWF		SZAM
	CALL		KIJELZES	
	
	MOVLW		.6				
	MOVWF		XX1
	MOVLW		.1
	MOVWF		XX1SZAML
	MOVLW		B'10000000'
	MOVWF		XX2
	MOVLW		.0
	MOVWF		XX2SZAML
	CALL		PONTOK
	
	MOVLW		.7
	MOVWF		XX1
	MOVLW		.1
	MOVWF		XX1SZAML
	MOVLW		B'10000000'
	MOVWF		XX2
	MOVLW		.0
	MOVWF		XX2SZAML
	MOVF		PT,W
	MOVWF		SZAM
	CALL		KIJELZES
	
	MOVLW		.10
	MOVWF		XX1
	MOVLW		.1
	MOVWF		XX1SZAML
	MOVLW		B'10000000'
	MOVWF		XX2
	MOVLW		.0
	MOVWF		XX2SZAML
	MOVF		PE,W
	MOVWF		SZAM
	CALL		KIJELZES
	
	MOVLW		.13
	MOVWF		XX1
	MOVLW		.1
	MOVWF		XX1SZAML
	MOVLW		B'10000000'
	MOVWF		XX2
	MOVLW		.0
	MOVWF		XX2SZAML
	CALL		PONTOK
	
	MOVLW		.14
	MOVWF		XX1
	MOVLW		.1
	MOVWF		XX1SZAML
	MOVLW		B'10000000'
	MOVWF		XX2
	MOVLW		.0
	MOVWF		XX2SZAML
	MOVF		MST,W
	MOVWF		SZAM
	CALL		KIJELZES
	
	MOVLW		.17
	MOVWF		XX1
	MOVLW		.1
	MOVWF		XX1SZAML
	MOVLW		B'10000000'
	MOVWF		XX2
	MOVLW		.0
	MOVWF		XX2SZAML
	MOVF		MSE,W
	MOVWF		SZAM
	CALL		KIJELZES
	
	GOTO		FOPROGRAM

LEDVILLOGTATAS:
	
LEDEGY:
	MOVF		LEDVILLOG,W
	XORLW		.1
	BTFSS		STATUS,Z
	GOTO		LEDKETTO
	
	BSF		PORTC,7
	RETURN
	
LEDKETTO:
	MOVF		LEDVILLOG,W
	XORLW		.2
	BTFSS		STATUS,Z
	GOTO		LEDHAROM

	BSF		PORTC,7
	BSF		PORTC,6
	RETURN

LEDHAROM:
	MOVF		LEDVILLOG,W
	XORLW		.3
	BTFSS		STATUS,Z
	GOTO		LEDNEGY

	BSF		PORTC,7
	BSF		PORTC,6
	BSF		PORTC,5
	RETURN

LEDNEGY:
	MOVF		LEDVILLOG,W
	XORLW		.4
	BTFSS		STATUS,Z
	GOTO		LEDVEGE

	BSF		PORTC,7
	BSF		PORTC,6
	BSF		PORTC,5
	BSF		PORTC,4
	RETURN

LEDVEGE:
	CLRF		PORTC
	CLRF		LEDVILLOG
	RETURN

BEALLITAS:
	BTFSS		PORTB,3
	RETURN
	
	MOVLW		.0			
	MOVWF		XX1			
	MOVLW		.1
	MOVWF		XX1SZAML
	MOVLW		B'10000000'
	MOVWF		XX2
	MOVLW		.0
	MOVWF		XX2SZAML
	
	MOVLW		B'11111001'
	CALL		ROVIDITES
	MOVLW		B'00100010'
	CALL		ROVIDITES
	MOVLW		B'01010001'
	CALL		ROVIDITES
	MOVLW		B'10001010'
	CALL		ROVIDITES
	MOVLW		B'00000001'
	CALL		ROVIDITES

	MOVLW		B'00000010'
	CALL		ROVIDITES
	
	MOVLW		B'00100001'
	CALL		ROVIDITES
	MOVLW		B'00100010'
	CALL		ROVIDITES
	MOVLW		B'00100001'
	CALL		ROVIDITES
	MOVLW		B'00000010'
	CALL		ROVIDITES
		
	MOVLW		B'00000001'
	CALL		ROVIDITES
	
	MOVLW		B'00000010'
	CALL		ROVIDITES
	MOVLW		B'11111001'
	CALL		ROVIDITES
	MOVLW		B'00001010'
	CALL		ROVIDITES
	MOVLW		B'00001001'
	CALL		ROVIDITES
	MOVLW		B'00000010'
	CALL		ROVIDITES
	
	MOVLW		B'00000001'
	CALL		ROVIDITES
	
	MOVLW		B'01111010'
	CALL		ROVIDITES
	MOVLW		B'10100001'
	CALL		ROVIDITES
	MOVLW		B'10100010'
	CALL		ROVIDITES
	MOVLW		B'01111001'
	CALL		ROVIDITES
	MOVLW		B'00000010'
	CALL		ROVIDITES
	
	MOVLW		B'00000001'
	CALL		ROVIDITES
	
	MOVLW		B'11111010'
	CALL		ROVIDITES
	MOVLW		B'10101001'
	CALL		ROVIDITES
	MOVLW		B'10101010'
	CALL		ROVIDITES
	MOVLW		B'01010001'
	CALL		ROVIDITES
	MOVLW		B'00000010'
	CALL		ROVIDITES
	
	MOVLW		B'00000001'
	CALL		ROVIDITES
	
	MOVLW		B'01110010'
	CALL		ROVIDITES
	MOVLW		B'10001001'
	CALL		ROVIDITES
	MOVLW		B'10001010'
	CALL		ROVIDITES
	MOVLW		B'01110001'
	CALL		ROVIDITES
	MOVLW		B'00000010'
	CALL		ROVIDITES
	
	MOVLW		B'00000001'
	CALL		ROVIDITES
	
	MOVLW		B'11111010'
	CALL		ROVIDITES
	MOVLW		B'10100001'
	CALL		ROVIDITES
	MOVLW		B'10100010'
	CALL		ROVIDITES
	MOVLW		B'01011001'
	CALL		ROVIDITES
	
	CALL		DELAY
	
	INCF		TIPUSKESLELTETES		
	MOVF		TIPUSKESLELTETES,W		
	XORLW		.30						
	BTFSS		STATUS,Z
	GOTO		BEALLITAS
	
	CLRF		TIPUSKESLELTETES
	BSF		PORTC,3
	
	INCF		KERETSZAML
	MOVF		KERETSZAML,W
	XORLW		.2
	BTFSS		STATUS,Z
	GOTO		BEALLITAS
	
	BCF		PORTC,3
	CLRF		KERETSZAML
		
	GOTO		BEALLITAS	

TIPUSVAL:	
	BTFSC		PORTB,3
	RETURN
	
	INCF		TIPUS
	
	BSF		PORTC,3
	
TIPUS1:
	MOVF		TIPUS,W		
	XORLW		.1			
	BTFSS		STATUS,Z
	GOTO		TIPUS2
	
	MOVLW		.9
	MOVWF		XX1
	MOVLW		.1
	MOVWF		XX1SZAML
	MOVLW		B'10000000'
	MOVWF		XX2
	MOVLW		.0
	MOVWF		XX2SZAML
	
	CALL		NULL
	
	CALL		DELAY
	
	INCF		TIPUSKESLELTETES
	MOVF		TIPUSKESLELTETES,W
	XORLW		.150
	BTFSS		STATUS,Z
	GOTO		TIPUS1
	
	GOTO		TIPUSVEGE
	
TIPUS2:
	MOVF		TIPUS,W
	XORLW		.2
	BTFSS		STATUS,Z
	GOTO		TIPUS3
	
	MOVLW		.9
	MOVWF		XX1
	MOVLW		.1
	MOVWF		XX1SZAML
	MOVLW		B'10000000'
	MOVWF		XX2
	MOVLW		.0
	MOVWF		XX2SZAML
	
	CALL		FEJ0
	
	CALL		DELAY
	
	INCF		TIPUSKESLELTETES
	MOVF		TIPUSKESLELTETES,W
	XORLW		.150
	BTFSS		STATUS,Z
	GOTO		TIPUS2
	
	GOTO		TIPUSVEGE
	
TIPUS3:
	MOVF		TIPUS,W
	XORLW		.3
	BTFSS		STATUS,Z
	GOTO		TIPUSELOLROL
	
	MOVLW		.9
	MOVWF		XX1
	MOVLW		.1
	MOVWF		XX1SZAML
	MOVLW		B'10000000'
	MOVWF		XX2
	MOVLW		.0
	MOVWF		XX2SZAML
	
	CALL		ZOLI0
	
	CALL		DELAY
	
	INCF		TIPUSKESLELTETES
	MOVF		TIPUSKESLELTETES,W
	XORLW		.150
	BTFSS		STATUS,Z
	GOTO		TIPUS2
	
	GOTO		TIPUSVEGE
	
TIPUSELOLROL:
	MOVLW		.0
	MOVWF		TIPUS
	
TIPUSVEGE:
	CLRF		TIPUSKESLELTETES	
	
	BTFSS		PORTB,3		
	GOTO		TIPUSVAL
	
	BCF		PORTC,3
	
	RETURN

KIJELZES:				
						
NULLA0:
	MOVF		SZAM,W
	XORLW		.0
	BTFSS		STATUS,Z
	GOTO		EGY1
	
	MOVF		TIPUS,W		
	XORLW		.1
	BTFSC		STATUS,Z
	CALL		NULL
	
	MOVF		TIPUS,W
	XORLW		.2
	BTFSC		STATUS,Z
	CALL		FEJ0
	
	MOVF		TIPUS,W
	XORLW		.3
	BTFSC		STATUS,Z
	CALL		ZOLI0
	RETURN
	
EGY1:
	MOVF		SZAM,W
	XORLW		.1
	BTFSS		STATUS,Z
	GOTO		KETTO2
	
	MOVF		TIPUS,W
	XORLW		.1
	BTFSC		STATUS,Z
	CALL		EINS
	
	MOVF		TIPUS,W
	XORLW		.2
	BTFSC		STATUS,Z
	CALL		FEJ1
	
	MOVF		TIPUS,W
	XORLW		.3
	BTFSC		STATUS,Z
	CALL		ZOLI1
	RETURN
	
KETTO2:
	MOVF		SZAM,W
	XORLW		.2
	BTFSS		STATUS,Z
	GOTO		HAROM3
	
	MOVF		TIPUS,W
	XORLW		.1
	BTFSC		STATUS,Z
	CALL		ZWEI
	
	MOVF		TIPUS,W
	XORLW		.2
	BTFSC		STATUS,Z
	CALL		FEJ2
	
	MOVF		TIPUS,W
	XORLW		.3
	BTFSC		STATUS,Z
	CALL		ZOLI2
	RETURN

HAROM3:
	MOVF		SZAM,W
	XORLW		.3
	BTFSS		STATUS,Z
	GOTO		NEGY4
	
	MOVF		TIPUS,W
	XORLW		.1
	BTFSC		STATUS,Z
	CALL		DREI
	
	MOVF		TIPUS,W
	XORLW		.2
	BTFSC		STATUS,Z
	CALL		FEJ3
	
	MOVF		TIPUS,W
	XORLW		.3
	BTFSC		STATUS,Z
	CALL		ZOLI3
	RETURN

NEGY4:
	MOVF		SZAM,W
	XORLW		.4
	BTFSS		STATUS,Z
	GOTO		OT5
	
	MOVF		TIPUS,W
	XORLW		.1
	BTFSC		STATUS,Z
	CALL		VIER
	
	MOVF		TIPUS,W
	XORLW		.2
	BTFSC		STATUS,Z
	CALL		FEJ4
	
	MOVF		TIPUS,W
	XORLW		.3
	BTFSC		STATUS,Z
	CALL		ZOLI4
	RETURN
	
OT5:	
	MOVF		SZAM,W
	XORLW		.5
	BTFSS		STATUS,Z
	GOTO		HAT6
	
	MOVF		TIPUS,W
	XORLW		.1
	BTFSC		STATUS,Z
	CALL		FUNF
	
	MOVF		TIPUS,W
	XORLW		.2
	BTFSC		STATUS,Z
	CALL		FEJ5
	
	MOVF		TIPUS,W
	XORLW		.3
	BTFSC		STATUS,Z
	CALL		ZOLI5
	RETURN
	
HAT6:
	MOVF		SZAM,W
	XORLW		.6
	BTFSS		STATUS,Z
	GOTO		HET7
	
	MOVF		TIPUS,W
	XORLW		.1
	BTFSC		STATUS,Z
	CALL		SECHS
	
	MOVF		TIPUS,W
	XORLW		.2
	BTFSC		STATUS,Z
	CALL		FEJ6
	
	MOVF		TIPUS,W
	XORLW		.3
	BTFSC		STATUS,Z
	CALL		ZOLI6
	RETURN
	
HET7:
	MOVF		SZAM,W
	XORLW		.7
	BTFSS		STATUS,Z
	GOTO		NYOLC8
	
	MOVF		TIPUS,W
	XORLW		.1
	BTFSC		STATUS,Z
	CALL		SIEBEN
	
	MOVF		TIPUS,W
	XORLW		.2
	BTFSC		STATUS,Z
	CALL		FEJ7
	
	MOVF		TIPUS,W
	XORLW		.3
	BTFSC		STATUS,Z
	CALL		ZOLI7
	RETURN
	
NYOLC8:
	MOVF		SZAM,W
	XORLW		.8
	BTFSS		STATUS,Z
	GOTO		KILENC9
	
	MOVF		TIPUS,W
	XORLW		.1
	BTFSC		STATUS,Z
	CALL		ACHT
	
	MOVF		TIPUS,W
	XORLW		.2
	BTFSC		STATUS,Z
	CALL		FEJ8
	
	MOVF		TIPUS,W
	XORLW		.3
	BTFSC		STATUS,Z
	CALL		ZOLI8	
	RETURN

KILENC9:
	MOVF		SZAM,W
	XORLW		.9
	BTFSS		STATUS,Z
	RETURN
	
	MOVF		TIPUS,W
	XORLW		.1
	BTFSC		STATUS,Z
	CALL		NEUN
	
	MOVF		TIPUS,W
	XORLW		.2
	BTFSC		STATUS,Z
	CALL		FEJ9
	
	MOVF		TIPUS,W
	XORLW		.3
	BTFSC		STATUS,Z
	CALL		ZOLI9
	
	RETURN	

NULL:									
	MOVLW		B'01111110'		
	CALL		ROVIDITES
	MOVLW		B'10000001'
	CALL		ROVIDITES
	MOVLW		B'10000001'
	CALL		ROVIDITES
	MOVLW		B'10000001'
	CALL		ROVIDITES
	MOVLW		B'01111110'
	CALL		ROVIDITES
	RETURN

EINS:	
	MOVLW		B'00000000'
	CALL		ROVIDITES
	MOVLW		B'01000001'
	CALL		ROVIDITES
	MOVLW		B'11111111'
	CALL		ROVIDITES
	MOVLW		B'00000001'
	CALL		ROVIDITES
	MOVLW		B'00000000'
	CALL		ROVIDITES
	RETURN
	
ZWEI:
	MOVLW		B'01000011'
	CALL		ROVIDITES
	MOVLW		B'10000101'
	CALL		ROVIDITES
	MOVLW		B'10001001'
	CALL		ROVIDITES
	MOVLW		B'10010001'
	CALL		ROVIDITES
	MOVLW		B'01100001'
	CALL		ROVIDITES
	RETURN

DREI:	
	MOVLW		B'01000010'
	CALL		ROVIDITES
	MOVLW		B'10010001'
	CALL		ROVIDITES
	MOVLW		B'10010001'
	CALL		ROVIDITES
	MOVLW		B'10010001'
	CALL		ROVIDITES
	MOVLW		B'01101110'
	CALL		ROVIDITES
	RETURN

VIER:	
	MOVLW		B'00011000'
	CALL		ROVIDITES
	MOVLW		B'00101000'
	CALL		ROVIDITES
	MOVLW		B'01001001'
	CALL		ROVIDITES
	MOVLW		B'10011111'
	CALL		ROVIDITES
	MOVLW		B'00001001'
	CALL		ROVIDITES
	RETURN

FUNF:	
	MOVLW		B'11110010'
	CALL		ROVIDITES
	MOVLW		B'10010001'
	CALL		ROVIDITES
	MOVLW		B'10010001'
	CALL		ROVIDITES
	MOVLW		B'10010001'
	CALL		ROVIDITES
	MOVLW		B'10001110'
	CALL		ROVIDITES
	RETURN

SECHS:	
	MOVLW		B'01111110'
	CALL		ROVIDITES
	MOVLW		B'10010001'
	CALL		ROVIDITES
	MOVLW		B'10010001'
	CALL		ROVIDITES
	MOVLW		B'10010001'
	CALL		ROVIDITES
	MOVLW		B'01001110'
	CALL		ROVIDITES
	RETURN

SIEBEN:	
	MOVLW		B'01000000'
	CALL		ROVIDITES
	MOVLW		B'10000000'
	CALL		ROVIDITES
	MOVLW		B'10010001'
	CALL		ROVIDITES
	MOVLW		B'10111111'
	CALL		ROVIDITES
	MOVLW		B'11010001'
	CALL		ROVIDITES
	RETURN
	
ACHT:
	MOVLW		B'01101110'
	CALL		ROVIDITES
	MOVLW		B'10010001'
	CALL		ROVIDITES
	MOVLW		B'10010001'
	CALL		ROVIDITES
	MOVLW		B'10010001'
	CALL		ROVIDITES
	MOVLW		B'01101110'
	CALL		ROVIDITES
	RETURN

NEUN:
	MOVLW		B'01100000'
	CALL		ROVIDITES
	MOVLW		B'10010001'
	CALL		ROVIDITES
	MOVLW		B'10010001'
	CALL		ROVIDITES
	MOVLW		B'10010001'
	CALL		ROVIDITES
	MOVLW		B'01111110'
	CALL		ROVIDITES
	RETURN

FEJ0:
	MOVLW		B'01000000'
	CALL		ROVIDITES
	MOVLW		B'01000010'
	CALL		ROVIDITES
	MOVLW		B'00011010'
	CALL		ROVIDITES
	MOVLW		B'01000010'
	CALL		ROVIDITES
	MOVLW		B'01000000'
	CALL		ROVIDITES
	RETURN	

FEJ1:
	MOVLW		B'11000000'
	CALL		ROVIDITES
	MOVLW		B'11000010'
	CALL		ROVIDITES
	MOVLW		B'00011010'
	CALL		ROVIDITES
	MOVLW		B'11000010'
	CALL		ROVIDITES
	MOVLW		B'11000000'
	CALL		ROVIDITES
	RETURN	

FEJ2:
	MOVLW		B'11000100'
	CALL		ROVIDITES
	MOVLW		B'11000010'
	CALL		ROVIDITES
	MOVLW		B'00011010'
	CALL		ROVIDITES
	MOVLW		B'11000010'
	CALL		ROVIDITES
	MOVLW		B'11000100'
	CALL		ROVIDITES
	RETURN	

FEJ3:
	MOVLW		B'11000010'
	CALL		ROVIDITES
	MOVLW		B'11000010'
	CALL		ROVIDITES
	MOVLW		B'00011010'
	CALL		ROVIDITES
	MOVLW		B'11000010'
	CALL		ROVIDITES
	MOVLW		B'11000010'
	CALL		ROVIDITES
	RETURN	

FEJ4:
	MOVLW		B'11000001'
	CALL		ROVIDITES
	MOVLW		B'11000010'
	CALL		ROVIDITES
	MOVLW		B'00011010'
	CALL		ROVIDITES
	MOVLW		B'11000010'
	CALL		ROVIDITES
	MOVLW		B'11000001'
	CALL		ROVIDITES
	RETURN

FEJ5:
	MOVLW		B'11000011'
	CALL		ROVIDITES
	MOVLW		B'11000010'
	CALL		ROVIDITES
	MOVLW		B'00011010'
	CALL		ROVIDITES
	MOVLW		B'11000010'
	CALL		ROVIDITES
	MOVLW		B'11000011'
	CALL		ROVIDITES
	RETURN		

FEJ6:
	MOVLW		B'11000000'
	CALL		ROVIDITES
	MOVLW		B'11000011'
	CALL		ROVIDITES
	MOVLW		B'00011011'
	CALL		ROVIDITES
	MOVLW		B'11000011'
	CALL		ROVIDITES
	MOVLW		B'11000000'
	CALL		ROVIDITES
	RETURN	

FEJ7:
	MOVLW		B'11000011'
	CALL		ROVIDITES
	MOVLW		B'11000011'
	CALL		ROVIDITES
	MOVLW		B'00011011'
	CALL		ROVIDITES
	MOVLW		B'11000011'
	CALL		ROVIDITES
	MOVLW		B'11000011'
	CALL		ROVIDITES
	RETURN	

FEJ8:
	MOVLW		B'11000010'
	CALL		ROVIDITES
	MOVLW		B'11000011'
	CALL		ROVIDITES
	MOVLW		B'00011010'
	CALL		ROVIDITES
	MOVLW		B'11000011'
	CALL		ROVIDITES
	MOVLW		B'11000010'
	CALL		ROVIDITES
	RETURN	

FEJ9:
	MOVLW		B'11000100'
	CALL		ROVIDITES
	MOVLW		B'11000011'
	CALL		ROVIDITES
	MOVLW		B'00011010'
	CALL		ROVIDITES
	MOVLW		B'11000011'
	CALL		ROVIDITES
	MOVLW		B'11000100'
	CALL		ROVIDITES
	RETURN	

ZOLI0:
	MOVLW		B'00100010'
	CALL		ROVIDITES
	MOVLW		B'00100110'
	CALL		ROVIDITES
	MOVLW		B'00101010'
	CALL		ROVIDITES
	MOVLW		B'00110010'
	CALL		ROVIDITES
	MOVLW		B'00100010'
	CALL		ROVIDITES
	RETURN

ZOLI1:
	MOVLW		B'00011100'
	CALL		ROVIDITES
	MOVLW		B'00100010'
	CALL		ROVIDITES
	MOVLW		B'00100010'
	CALL		ROVIDITES
	MOVLW		B'00100010'
	CALL		ROVIDITES
	MOVLW		B'00011100'
	CALL		ROVIDITES
	RETURN

ZOLI2:
	MOVLW		B'00000000'
	CALL		ROVIDITES
	MOVLW		B'00000000'
	CALL		ROVIDITES
	MOVLW		B'00111110'
	CALL		ROVIDITES
	MOVLW		B'00000010'
	CALL		ROVIDITES
	MOVLW		B'00000010'
	CALL		ROVIDITES
	RETURN

ZOLI3:
	MOVLW		B'00000000'
	CALL		ROVIDITES
	MOVLW		B'00000000'
	CALL		ROVIDITES
	MOVLW		B'10111110'
	CALL		ROVIDITES
	MOVLW		B'00000000'
	CALL		ROVIDITES
	MOVLW		B'00000000'
	CALL		ROVIDITES
	RETURN

ZOLI4:
	MOVLW		B'00111110'
	CALL		ROVIDITES
	MOVLW		B'00001000'
	CALL		ROVIDITES
	MOVLW		B'00001000'
	CALL		ROVIDITES
	MOVLW		B'00010100'
	CALL		ROVIDITES
	MOVLW		B'00100010'
	CALL		ROVIDITES
	RETURN

ZOLI5:
	MOVLW		B'00011100'
	CALL		ROVIDITES
	MOVLW		B'10100010'
	CALL		ROVIDITES
	MOVLW		B'00100010'
	CALL		ROVIDITES
	MOVLW		B'10100010'
	CALL		ROVIDITES
	MOVLW		B'00011100'
	CALL		ROVIDITES
	RETURN

ZOLI6:
	MOVLW		B'00111110'
	CALL		ROVIDITES
	MOVLW		B'00010000'
	CALL		ROVIDITES
	MOVLW		B'00001000'
	CALL		ROVIDITES
	MOVLW		B'00000100'
	CALL		ROVIDITES
	MOVLW		B'00111110'
	CALL		ROVIDITES
	RETURN

ZOLI7:
	MOVLW		B'00000000'
	CALL		ROVIDITES
	MOVLW		B'00000000'
	CALL		ROVIDITES
	MOVLW		B'10111110'
	CALL		ROVIDITES
	MOVLW		B'00000000'
	CALL		ROVIDITES
	MOVLW		B'00000000'
	CALL		ROVIDITES
	RETURN

ZOLI8:
	MOVLW		B'00011100'
	CALL		ROVIDITES
	MOVLW		B'00100010'
	CALL		ROVIDITES
	MOVLW		B'00101010'
	CALL		ROVIDITES
	MOVLW		B'00101010'
	CALL		ROVIDITES
	MOVLW		B'00001100'
	CALL		ROVIDITES
	RETURN

ZOLI9:
	MOVLW		B'00000000'
	CALL		ROVIDITES
	MOVLW		B'11111011'
	CALL		ROVIDITES
	MOVLW		B'11111011'
	CALL		ROVIDITES
	MOVLW		B'11111011'
	CALL		ROVIDITES
	MOVLW		B'00000000'
	CALL		ROVIDITES
	RETURN

PONTOK:
	MOVLW		B'00100100'
	CALL		ROVIDITES
	RETURN

ROVIDITES:
	MOVWF		OSZLOP
	CALL		TV
	RETURN

TV:

SOR1:
	MOVF		OSZLOP,W		
	ANDLW		B'00000001'		
	XORLW		B'00000001'
	BTFSS		STATUS,Z
	GOTO		SOR2			
	
	MOVLW		B'10100100'		
	MOVWF		ADADAT1
	MOVLW		B'00000000'
	MOVWF		ADADAT2
	
	CALL		ADDATA1
	CALL		ADDATA2
	
	MOVF		XX1,W			
	ADDLW		B'00100000'
	MOVWF		ADADAT1
	MOVF		XX2,W
	MOVWF		ADADAT2
	
	CALL		ADDATA1
	CALL		ADDATA2

	CALL		OUT				

SOR2:							
	MOVF		OSZLOP,W
	ANDLW		B'00000010'
	XORLW		B'00000010'
	BTFSS		STATUS,Z
	GOTO		SOR3
	
	MOVLW		B'10101000'
	MOVWF		ADADAT1
	MOVLW		B'00000000'
	MOVWF		ADADAT2
	
	CALL		ADDATA1
	CALL		ADDATA2
	
	MOVF		XX1,W
	ADDLW		B'00100000'
	MOVWF		ADADAT1
	MOVF		XX2,W
	MOVWF		ADADAT2
	
	CALL		ADDATA1
	CALL		ADDATA2

	CALL		OUT

SOR3:
	MOVF		OSZLOP,W
	ANDLW		B'00000100'
	XORLW		B'00000100'
	BTFSS		STATUS,Z
	GOTO		SOR4
	
	MOVLW		B'10101100'
	MOVWF		ADADAT1
	MOVLW		B'00000000'
	MOVWF		ADADAT2
	
	CALL		ADDATA1
	CALL		ADDATA2
	
	MOVF		XX1,W
	ADDLW		B'00100000'
	MOVWF		ADADAT1
	MOVF		XX2,W
	MOVWF		ADADAT2
	
	CALL		ADDATA1
	CALL		ADDATA2

	CALL		OUT

SOR4:
	MOVF		OSZLOP,W
	ANDLW		B'00001000'
	XORLW		B'00001000'
	BTFSS		STATUS,Z
	GOTO		SOR5
	
	MOVLW		B'10110000'
	MOVWF		ADADAT1
	MOVLW		B'00000000'
	MOVWF		ADADAT2
	
	CALL		ADDATA1
	CALL		ADDATA2
	
	MOVF		XX1,W
	ADDLW		B'00100000'
	MOVWF		ADADAT1
	MOVF		XX2,W
	MOVWF		ADADAT2
	
	CALL		ADDATA1
	CALL		ADDATA2

	CALL		OUT

SOR5:
	MOVF		OSZLOP,W
	ANDLW		B'00010000'
	XORLW		B'00010000'
	BTFSS		STATUS,Z
	GOTO		SOR6
	
	MOVLW		B'10110100'
	MOVWF		ADADAT1
	MOVLW		B'00000000'
	MOVWF		ADADAT2
	
	CALL		ADDATA1
	CALL		ADDATA2
	
	MOVF		XX1,W
	ADDLW		B'00100000'
	MOVWF		ADADAT1
	MOVF		XX2,W
	MOVWF		ADADAT2
	
	CALL		ADDATA1
	CALL		ADDATA2

	CALL		OUT

SOR6:
	MOVF		OSZLOP,W
	ANDLW		B'00100000'
	XORLW		B'00100000'
	BTFSS		STATUS,Z
	GOTO		SOR7
	
	MOVLW		B'10111000'
	MOVWF		ADADAT1
	MOVLW		B'00000000'
	MOVWF		ADADAT2
		
	CALL		ADDATA1
	CALL		ADDATA2
	
	MOVF		XX1,W
	ADDLW		B'00100000'
	MOVWF		ADADAT1
	MOVF		XX2,W
	MOVWF		ADADAT2
	
	CALL		ADDATA1
	CALL		ADDATA2

	CALL		OUT

SOR7:
	MOVF		OSZLOP,W
	ANDLW		B'01000000'
	XORLW		B'01000000'
	BTFSS		STATUS,Z
	GOTO		SOR8
	
	MOVLW		B'10111100'
	MOVWF		ADADAT1
	MOVLW		B'00000000'
	MOVWF		ADADAT2
	
	CALL		ADDATA1
	CALL		ADDATA2
	
	MOVF		XX1,W
	ADDLW		B'00100000'
	MOVWF		ADADAT1
	MOVF		XX2,W
	MOVWF		ADADAT2
	
	CALL		ADDATA1
	CALL		ADDATA2

	CALL		OUT

SOR8:
	MOVF		OSZLOP,W
	ANDLW		B'10000000'
	XORLW		B'10000000'
	BTFSS		STATUS,Z
	GOTO		SEMMI			
	
	MOVLW		B'10111111'
	MOVWF		ADADAT1
	MOVLW		B'11111110'
	MOVWF		ADADAT2
	
	CALL		ADDATA1
	CALL		ADDATA2
	
	MOVF		XX1,W
	ADDLW		B'00100000'
	MOVWF		ADADAT1
	MOVF		XX2,W
	MOVWF		ADADAT2
	
	CALL		ADDATA1
	CALL		ADDATA2

	CALL		OUT

SEMMI:

	INCF		XX1SZAML		
	MOVF		XX1SZAML,W		
	XORLW		.2
	BTFSS		STATUS,Z
	GOTO		NEMNOVELXX1
	
	INCF		XX1
	CLRF		XX1SZAML
	
NEMNOVELXX1:
	INCF		XX2SZAML		
	MOVF		XX2SZAML,W
	XORLW		.1
	BTFSS		STATUS,Z
	GOTO		XX2EGY
	
	CLRF		XX2
	RETURN
	
XX2EGY:
	MOVLW		B'10000000'
	MOVWF		XX2
	CLRF		XX2SZAML
	
	RETURN
ADDATA1:
	MOVF		ADADAT1,W
	MOVWF		TAROLO
	
ELEJE:
	MOVF		TAROLO,W			
	ANDLW		B'10000000'
	MOVWF		OSSZEHASONLIT		
	XORLW		B'10000000'			
	BTFSS		STATUS,Z			
	GOTO		NULLA
	
EGY:
	BSF		PORTB,2			
	GOTO		TOVABB
	
NULLA:
	BCF		PORTB,2			
	
TOVABB:
	BCF		PORTB,0			
	
	BSF		PORTB,1			
	NOP
	BCF		PORTB,1
	
	RLF		TAROLO			
	
	INCF		NYOLCBIT		
	MOVF		NYOLCBIT,W
	XORLW		.8
	BTFSS		STATUS,Z
	GOTO		ELEJE
	
	CLRF		NYOLCBIT
	
	RETURN

ADDATA2:
	MOVF		ADADAT2,W
	MOVWF		TAROLO
	
ELEJE2:
	MOVF		TAROLO,W
	ANDLW		B'10000000'
	MOVWF		OSSZEHASONLIT		
	XORLW		B'10000000'			
	BTFSS		STATUS,Z
	GOTO		NULLA2
	
EGY2:
	BSF		PORTB,2
	GOTO		TOVABB2
	
NULLA2:
	BCF		PORTB,2
	
TOVABB2:
	BSF		PORTB,1
	NOP
	BCF		PORTB,1
	
	RLF		TAROLO
	
	INCF		NYOLCBIT
	
FOLYT:
	MOVF		NYOLCBIT,W
	XORLW		.8
	BTFSS		STATUS,Z
	GOTO		ELEJE2
	
	BSF		PORTB,0				
								
	CLRF		NYOLCBIT
	
	RETURN

OUT:
	MOVLW		B'10000000'			
	MOVWF		ADADAT1				
	MOVLW		B'00000000'
	MOVWF		ADADAT2

	CALL		ADDATA1				
	CALL		ADDATA2
		
	RETURN

DELAY:	
	MOVLW		d'40'
	MOVWF		T1
DEL:	MOVLW		d'10'
	MOVWF		T2
DEL1:
	DECFSZ		T2,f
	GOTO		DEL1
	DECFSZ		T1,f
	GOTO		DEL
	RETURN

DELAY2:	
	MOVLW		d'255'
	MOVWF		T3
DEL2:	MOVLW		d'255'
	MOVWF		T4
DEL3:
	DECFSZ		T4,f
	GOTO		DEL3
	DECFSZ		T3,f
	GOTO		DEL2
	RETURN
	
	END