;
;         "dfn_fb_2.txt"    ,    ()
;
;------------------------------------------------------
; variable definitions
;(  )
;______________________________________________________
;   -  
;
; label equ expr
;
 bus_dtr  equ 0 ;  / 
        ;  reset      +5 
        ;       0
        ;       
				;     
 bus_clc  equ 2 ;    
        ;  reset/cold init      +5 
        ;    ()  ()
        ;   0
 bus_qt   equ 1 ;  
        ;  reset/cold init      +5 
        ;   0
        ;   ,   
 pgf_prog equ 3 ;   /prog  pin30(ale/prog)
        ;  
        ;   =0
 pgf_busy equ 4 ;     busy/ready
        ;   S1/S2   pin10(P3.0)
        ;   pin114(P3.4)  
        ;   -   0
 pgf_evpp equ 5 ;   +12 
        ;   =0

 Pfb2_6 equ 6 ;  2.6    fb4012
 Pfb2_7 equ 7 ;  2.7    fb4012
 Pfb3_6 equ 6 ;  3.6    fb4012
 Pfb3_7 equ 7 ;  3.7    fb4012


 trd_mask equ (1<<bus_clc || 1<<bus_qt || 1<<bus_dtr)
 Pfb_mask equ 0xC0 ;    
                 ;  P2  3  fb4012

 clear_tm equ 55537 ;    
        ;   (10mS)
 sec_paus equ 15537 ;    
        ; 0,05S -    
 sec_ps2 equ 20 ;     1S

; time_wr  equ 50 ;     
                 ;  linc_port.Pg_prog (1-110)

 qt_eror equ 0xEE ;   "   "
 qt_good equ 0x55 ;   " 
                  ;   "

 atmel_id      equ 0x1E ;  
 type51        equ 0x51 ;   89C51
 type52        equ 0x52 ;   89C52
 vpp_5v        equ 0x05 ;  Vpp = +5V
 vpp_12v       equ 0xFF ;  Vpp = +12V
 sign0_ac512   equ 0x30 ;     0 
                 ;  
 sign1_ac512   equ 0x31 ;     1 
                 ;  
 sign2_ac512   equ 0x32 ;     2 
                 ;   Vpp

;
 smart_vectors equ 0x0100 ;   
        ;  
;
;------------------------------------------------------------------
;             -
;   128   "" 
;
RD_Pf0_v   equ 0b00000000 ;     0
                   ;  1  
WR_Pf0_v   equ 0b00000010 ;     0
                   ;    smart_qt
Wbm1_Pf0_v equ 0b00000100 ;    
                   ;       0
                   ;    smart_qt
Wbm0_Pf0_v equ 0b00000110 ;    
                   ;       0
                   ;    smart_qt
;-------------------------------------------------
RD_Pf1_v   equ 0b00001000 ;     1
                   ;  1  
WR_Pf1_v   equ 0b00001010 ;     1
                   ;    smart_qt
Wbm1_Pf1_v equ 0b00001100 ;    
                   ;       1
                   ;    smart_qt
Wbm0_Pf1_v equ 0b00001110 ;    
                   ;       1
                   ;    smart_qt
;-------------------------------------------------
RD_Pf2_v   equ 0b00010000 ;     2
                   ;  1  
WR_Pf2_v   equ 0b00010010 ;     2
                   ;    smart_qt
Wbm1_Pf2_v equ 0b00010100 ;    
                   ;       2
                   ;    smart_qt
Wbm0_Pf2_v equ 0b00010110 ;    
                   ;       2
                   ;    smart_qt
;-------------------------------------------------
RD_Pf3_v   equ 0b00011000 ;     3
                   ;  1  
WR_Pf3_v   equ 0b00011010 ;     3
                   ;    smart_qt
Wbm1_Pf3_v equ 0b00011100 ;    
                   ;       3
                   ;    smart_qt
Wbm0_Pf3_v equ 0b00011110 ;    
                   ;       3
                   ;    smart_qt
;------------------------------------------------------------------
INC_Pf0_v equ 0b00100000 ;   0
                  ;    smart_qt
INC_Pf1_v equ 0b00100010 ;   1
                  ;    smart_qt
INC_Pf2_v equ 0b00100100 ;   2
                  ;    smart_qt
INC_Pf3_v equ 0b00100110 ;   3
                  ;    smart_qt
;-------------------------------------------------
DEC_Pf0_v equ 0b00101000 ;   0
                  ;    smart_qt
DEC_Pf1_v equ 0b00101010 ;   1
                  ;    smart_qt
DEC_Pf2_v equ 0b00101100 ;   2
                  ;    smart_qt
DEC_Pf3_v equ 0b00101110 ;   3
                  ;    smart_qt
;-------------------------------------------------
CLR_Pf0_v equ 0b00110000 ;  000   0
                  ;    smart_qt
CLR_Pf1_v equ 0b00110010 ;  000   1
                  ;    smart_qt
CLR_Pf2_v equ 0b00110100 ;  000   2
                  ;    smart_qt
CLR_Pf3_v equ 0b00110110 ;  003   3
                  ;    smart_qt
;-------------------------------------------------
SET_Pf0_v equ 0b00111000 ;  0FF   0
                  ;    smart_qt
SET_Pf1_v equ 0b00111010 ;  0FF   1
                  ;    smart_qt
SET_Pf2_v equ 0b00111100 ;  0FF   2
                  ;    smart_qt
SET_Pf3_v equ 0b00111110 ;  0FF   3
                  ;    smart_qt
;-------------------------------------------------
CPL_Pf0_v equ 0b01000000 ;     0
                  ;    smart_qt
CPL_Pf1_v equ 0b01000010 ;     1
                  ;    smart_qt
CPL_Pf2_v equ 0b01000100 ;     2
                  ;    smart_qt
CPL_Pf3_v equ 0b01000110 ;     3
                  ;   3  3   1
                  ;    smart_qt
;------------------------------------------------------------------
oll_on_v   equ 0b01001000 ; 
                   ;     0xFF
                   ;    smart_qt
oll_off_v  equ 0b01001010 ; 
                   ;     0x00
                   ;    smart_qt
;-------------------------------------------------
read_hed_v equ 0b01001100 ; 
                   ;   
                   ;  11  
;-------------------------------------------------
LONG_com_v equ 0b01001110 ;  " "
                  ;    
                  ;   
                  ;   - 
                  ; 
;-------------------------------------------------
;            
;
;  8951/52
;    " "
;    
;    vpph
; 0  vpph=0  1  vpph=1
;    smart_qt
; oll_clear_c512 equ 0x044A
;------------------------------------------
;  8951/52
;       " "
;  
; "    "
;     
;    
;     
;     
;   
;  
; rd_sign_c512 equ 0x0482
;------------------------------------------
;  8951/52
; "    "
;     
;    
;     
;     
;   
;  
; rd_byte_c512 equ 0x04A9
;------------------------------------------
;  8951/52
;   " " ( )
;     
;    
;     
;    
;      
;   vpph (0  vpph=0  1  vpph=1)
;       pgf_prog
;    time_wr
;   
;      
; 
; wr_byte_c512 equ 0x04CD




;
;______________________________________________________
;
;      (0x00-0x7F)
;
; label: .ds expr
;
  .DSEG ;     (.dseg at 0xnn)
;   ----------- RB0 --------------------
 rbt0:       .ds 8 ; RB0   
;   ----------- RB1 --------------------
 rbt1:       .ds 8 ; RB1  
;   ----------- RB2 --------------------
; rbt2:       .ds 8 ; RB2  
;   ----------- RB3 --------------------
; rbt3:       .ds 8 ; RB3  
;--------------------------------------
; RB2  
  tmp0:      .ds 1 ;   
  tmp1:      .ds 1 ;   
  tmp2:      .ds 1 ;   
  tmp3:      .ds 1 ;   
  tmp4:      .ds 1 ;   
  tmp5:      .ds 1 ;   
  tmp6:      .ds 1 ;   
  tmp7:      .ds 1 ;   
;--------------------------------------
; RB3  
  tmp8:      .ds 1 ;   
  tmp9:      .ds 1 ;   
  tmpA:      .ds 1 ;   
  tmpB:      .ds 1 ;   
  tmpC:      .ds 1 ;   
  tmpD:      .ds 1 ;   
  tmpE:      .ds 1 ;   
  tmpF:      .ds 1 ;   
;
;______________________________________________________
;
;    
;
; label: .ds expr (max 16 registers)
;
 bitmap: .ds 8 ; 8    
 flags:  .ds 8 ; 8     
              ;  64    00x40  0x7F
;______________________________________________________
;
;    
;    0x5F 
; label: .ds expr (max 48 registers)
;
 tik_cnt: .ds 1 ;      0,01 
 bptr_l:  .ds 1 ;    
                ;     
 bptr_h:  .ds 1 ;    
                ;     
 temp_i:  .ds 1 ;       
 temp_o:  .ds 1 ;      
 time_wr: .ds 1 ;      
                ;  linc_port.Pg_prog (1-110)


;
;----------------------------------------------------------------
;
;    -   
;
;         
; ( flags - flags+8)
; label: .dbit expr
;
   .BSEG at ((flags-bitmap)*8) ;  
           ;   (.bseg at 0xnn)
 data_key: .dbit 1 ;   /
           ; data_key=0 -   
           ; data_key=1 -   
 ver_er:   .dbit 1 ;  " "
 vpph:     .dbit 1 ;   
           ; vpph=0 Vpp=5V
           ; vpph=1 Vpp=12V
 sys_tik:  .dbit 1 ;     

;
;----------------------------------------------------------------
;
;    -   (redefened)
;

 .define cntbit_t R2 ; r2 rb0  
 .define cnt_tm R3 ; r3 rb0   
 .define data_t R7 ; r7 rb0   
 .define txd_port P3 ; 3   /  
 .define linc_port3 P3 ; 3   
 .define data_bus P0 ; P0   / 
 .define addr_l P1 ; P1      
 .define addr_h P2 ; P2      
 .define linc_port2 P2 ; 2   

;______________________________________________________
;   -    (EEPROM)
;
;  .eseg
;______________________________________________________
;  .CSEG
;
;----------------------------------------------------------------
;