;
;
;          "semetr.txt" 
;     
;      
;     : 
;      +/-1 
;   7
;
;---------------------------------------------------------------
;                 
; ( ""   "?"   "?   ")
 secmetr:
    mov left_bp+1,#high(stwatch)
    mov left_bp,#low(stwatch)
    mov right_bp+1,#high(tmgluks)
    mov right_bp,#low(tmgluks)
    mov main_bp+1,#high(secmetr)
    mov main_bp,#low(secmetr)
    mov stabl+1,#high(subrus) ;      
    mov stabl,#low(subrus) ;       
    mov target+1,#high(restart_s)
    mov target,#low(restart_s)
    mov retter+1,#high(baksp_s)
    mov retter,#low(baksp_s)
    mov prefekt,#(7<<4) ;    0x00-0x0F (  masktbl)
                 ;       
                 ;        masktbl7
    ptints str8,frame0 ;   frame0+refram   str8
                  ; '      '
       clr fmnk ; ""   
       ;       /0 !!!
;   /0    TF0
      acall zeroid ;   
      acall confint2 ;    /
      lo_sbuf sp_buf1 ;     
      ljmp open_cor ; in file "datclock.txt"
;---------------------------------------------------------------
;   ( ""   
;      0(?) frame1   )
 baksp_s:
     jb tiksef,falses ;   
		        ;     
	   clr ET0 ;    TF0
     setb fmnk ; ""   
    ljmp re_baksp ; in file "datclock.txt"
  falses:
     ljmp step4 ;      
;---------------------------------------------------------------
;  /
; ( ""   0 (?) frame1   )
;       
;   tiksef    TR0
;       
;     
;
 restart_s:
      jbc tiksef,secstop
     setb tiksef ;     ""
         ;     /0
     setb TR0 ;  /0 ( )
     ljmp step4 ;      
  secstop:
     clr TR0 ;  /0 ( )
     lcall viev_sb ; (in file "sektim.txt")      
            ;   sektims (  )
     clr tiksef
     ljmp step4 ;      
;---------------------------------------------------------------
;  
;
;---------------------------------------------------------------
;      =""( downf=0)
;    
;  ="" ( downf=1)
;       
; .  tiksef=0
;   
 resecs:
     jnb tiksef,reseter ;    tiksef=0
     ljmp step4 ;      
  reseter:
      jbc downf,lo_resec
      mov bufust0,setibu0
      mov bufust1,setibu1
      mov bufust2,setibu2
  lo_resec:
      acall zeroid
      acall confta
      lcall viev_sb ; (in file "sektim.txt")      
            ;   sektims (  )
      ljmp step4 ;      
;---------------------------------------------------------------
 zeroid:
   clr a
   mov setibu0,a ;   
   mov setibu1,a
   mov setibu2,a
  ret
;---------------------------------------------------------------
;   /0    TF0
;         
;
; /0     
              ;  RCAP0H:RCAP0L
 confint2:
     mov a,corsek
      add a,#8
      mov rcap0,a
	    clr a
	    addc a,corsek+1
	    mov rcap0+1,a ;    +8 (  corsek)
 confta:
    mov TL0,rcap0
	  mov TH0,rcap0+1 ;     /0
    mov too_clk0,#mark_r ;     / 
    setb ET0 ;   TF0 
  ret