;
;         "tmm_ktp.txt" ;  
;
;---------------------------------------------
;tmm_m60     equ .60 ;    
;tmm_m24     equ .24 ;  
;tmm_flags   res 1 ;   
;tmm_sek     res 1 ;  
;tmm_min     res 1 ;  
;tmm_hors    res 1 ;  
;tmm_m_adj   res 1 ;    
;tmm_h_adj   res 1 ;    
;   tmm_flags
;tmm_apdnf   equ 0 ;    0=, 1=
;tmm_tmoff   equ 2 ;  
;tmm_dissn   equ 4 ;    
;               ;    
;tmm_zud     equ 5 ;    
;               ; cnt_zum+2    
;tmm_ino     equ 6 ;    TMR1H:TMR1L
;     ;  - /  
;
;---------------------------------------------
;
TMM      CODE
proc_tmms      ;     /1 irq
     btfss tmm_flags,tmm_apdnf
      goto secmetr ; tmm_apdnf=0  
daun_tmm       ; ""  
   decf tmm_sek,f ;  -1
   btfss STATUS,Z
   goto kits_wrk ;      kits_wrk
    movlw 3 ;   
    movwf tmp_f
    tstf tmm_sek
    btfsc STATUS,Z
    decf tmp_f,f
    tstf tmm_min
    btfsc STATUS,Z
    decf tmp_f,f
    tstf tmm_hors
    btfsc STATUS,Z
    decf tmp_f,f
    tstf tmp_f
    btfsc STATUS,Z
   goto tmm_stop ;    = 0  
  goto disout ;      
        ;      0xFF
        ;      
kits_wrk
   movlw mrak
   xorwf tmm_sek,w
   btfss STATUS,Z
   goto disout ;  ,   0xFF
tst_min      ;     
    movlw .59 ;
    movwf tmm_sek ;  = 59
    decf tmm_min,f ;  -1
    btfsc STATUS,Z
    goto disout ;  ,  tmm_min=0
    movlw mrak
   xorwf tmm_min,w
   btfss STATUS,Z
    goto disout ;  ,   0xFF
tst_hors
     movlw .59 ;  tmm_hors   0
     movwf tmm_min ;  = 59
     decf tmm_hors,f ;  -1
    goto disout ;  
tmm_stop
     bcf tmm_flags,tmm_dissn ;    tmm_dissn
     bcf T1CON,TMR1ON ;   - 
     bsf tmm_flags,tmm_tmoff
   goto disout
;
;-----------------------------------------------
;
secmetr
      incf tmm_sek,f ;  +1
      movlw tmm_m60
      xorwf tmm_sek,w ;    
      btfss STATUS,Z
    goto disout
tmm_mplus
      clrf tmm_sek
      incf tmm_min,f ;  +1
      movlw tmm_m60
      xorwf tmm_min,w ;    
      btfss STATUS,Z
    goto disout
tmm_hplus
      clrf tmm_min
      incf tmm_hors,f ;  +1
      movlw tmm_m24
      xorwf tmm_hors,w ;    
      btfsc STATUS,Z
      clrf tmm_hors
;------------------------------------------------
disout
       call dabuf_tmmw
      call prepare
     call w_ksda ;    
             ;  "  ,,  "
    goto popper
;
;------------------------------------------------
;
;      
; /  
;
dabuf_tmmw
  clrf kd_pos1
  clrf kd_pos2
;  
  clrw
  movwf mt_dath ;   
  movwf mt_didh
  movf tmm_hors,w
  movwf mt_datl ;   
  movwf mt_didl
  bsf mt_flags,shot_ck
  call bin_dec
  movf mt_re1,w
  call kaznak
  movwf kd_pos3
  movf mt_re0,w
  call kaznak
  movwf kd_pos4
  bsf kd_pos4,s_H
;  
  clrw
  movwf mt_dath ;   
  movwf mt_didh
  movf tmm_min,w
  movwf mt_datl ;   
  movwf mt_didl
  bsf mt_flags,shot_ck
  call bin_dec
  movf mt_re1,w
  call kaznak
  movwf kd_pos5
  movf mt_re0,w
  call kaznak
  movwf kd_pos6
  bsf kd_pos6,s_H
;  
  clrw
  movwf mt_dath ;   
  movwf mt_didh
  movf tmm_sek,w
  movwf mt_datl ;   
  movwf mt_didl
  bsf mt_flags,shot_ck
  call bin_dec
  movf mt_re1,w
  call kaznak
  movwf kd_pos7
  movf mt_re0,w
  call kaznak
  movwf kd_pos8
  clrf kd_pos9
  clrf kd_pos10
 return
;
;------------------------------------------------
;
;
;------------------------------------------------
;
;      
; /   
;
dabuf_tmmu
  clrf kd_pos1
  movlw 1<<s_G
  movwf kd_pos2
;  
  clrw
  movwf mt_dath ;   
  movwf mt_didh
  movf tmm_h_adj,w
  movwf mt_datl ;   
  movwf mt_didl
  bsf mt_flags,shot_ck
  call bin_dec
  movf mt_re1,w
  call kaznak
  movwf kd_pos3
  movf mt_re0,w
  call kaznak
  movwf kd_pos4
  bsf kd_pos4,s_H
;  
  clrw
  movwf mt_dath ;   
  movwf mt_didh
  movf tmm_m_adj,w
  movwf mt_datl ;   
  movwf mt_didl
  bsf mt_flags,shot_ck
  call bin_dec
  movf mt_re1,w
  call kaznak
  movwf kd_pos5
  movf mt_re0,w
  call kaznak
  movwf kd_pos6
  movlw 1<<s_G
  movwf kd_pos7
  movwf kd_pos8
  movwf kd_pos9
  clrf kd_pos10
 return
;
;-----------------------------------------------
;
;
;-----------------------------------------------
;