;
;      
;     "hs_init_1.txt"

   .org (irq_res+int_vectors_size) ;    
		init:                    ;   
;        .
;    .

;---------------------------------------------------------------
; :
;  -  RC- 9,6 
;   power-on-reset
;Clkpr -   - < > (/8)  
;Osccal -   -  9,6    
; BOD  -
;WDT     
; -     
;---------------------------------------------------------------
;   
;Didr0 = 0  
;      
;---------------------------------------------------------------
;  
    sbi ACSR,ACD

;     .
    ldi tmp0,~(1<<DATO_ln | 1<<CLC_ln | 1<<WR_ln)
    out PORTB,tmp0 ;      0
    com tmp0
    out DDRB,tmp0 ;    
                ;    =0
;    MCUCR.PUD=0    
;       =1
;   "  1"

;     0
;    OCF0A  0,001S
   ldi tmp0,div150
	 out OCR0A,tmp0 ;   
	 clr tmp0
	 out TCNT0,tmp0
	 out TCCR0B,tmp0
	 ldi tmp0,1<<WGM01
	 out TCCR0A,tmp0 ;  ,   
	            ;   /

;  
   ldi tmp0,1<<OCIE0A
   out TIMSK0,tmp0
;    
;     sei
;   
;     ldi tmp0,tik_tak
;     out TCCR0B,tmp0
;---------------------------------------------------------------------
;
;      
;  "soft init"
 sf_init:
      ldi tmp0,cnts_l ; cnts_l=200
			 mov tic_cntl,tmp0 ;    
			ldi tmp0,cnts_h ; cnts_h=5
			 mov tic_cnth,tmp0 ;    
			 ldiw x,sekond
			 clr tmp0
			 st x+,tmp0
			 st x+,tmp0
			 st x+,tmp0
			 st x+,tmp0
			 st x+,tmp0
			 st x+,tmp0 ;  
			rcall print ; / 
			sbr flags,1<<en_sek ;   en_sek=1
		sei ;  
		 ldi tmp0,tik_tak
     out TCCR0B,tmp0 ; 
 wt_stop:
     sbrs flags,tim_tik
    rjmp wt_stop
      rcall sekmetr ;  tim_tik=1   
   rjmp wt_stop
;
;---------------------------------------------------------------------
;    
  tiks:
     sbr flags,1<<tim_tik ;    tim_tik=1
     reti
;