;
;         "dfn_pgx.txt"    ,    ()
;
;------------------------------------------------------
; variable definitions
;(  )
;______________________________________________________
;   -  
;
; label equ expr
;
 m_bottle     equ 0x029D ;    bottle 
 m_proc_txd_init     equ 0x047D ;    proc_txd_init 
 m_proc_txd      equ 0x0482 ;    proc_txd 
 xon_kod      equ 0x17 ;  "  "
 xoff_kod     equ 0x19 ;  " "
 start_kod    equ 0x3A ;   ':'
 vk_kod       equ 0x0D ;   " " ('\r')
 ps_kod       equ 0x0A ;   " " ('\n')
 data_string  equ 0    ;   
 endf_string  equ 1    ;     
 adr_seg_srt  equ 2    ;    
 adr_lin_str  equ 4    ;    
 tm_ertmo     equ 20   ;     
                      ;  0,1 
 m_key_proc equ 0xFFF0 ;    
             ;   0x0000-0xnnnn  
             ; (  key_proc )
 sys_clc1 equ 18 ;    0,005 /
              ;    
 sys_clc2 equ 36 ;    0,01 /
              ;    
 tr_spid  equ 0xFD ;   TL1: 0xE8  1200 
                ; 0xFD  9600 
 KEY_EA   equ 5 ; =P3.5=/T1    (  key_ea=0 )
               ; ,   = 0
 S_SCL    equ 4 ; (S_IN) =P3.4=/T0     S1
              ;    ,
              ; ,   = 0
 S_RBT    equ 3 ; (IND_L) =P3.3=/INT1    HL4(EL)
              ; /  / 
              ;  ( )    1
              ; ,   = 0
              ;       
              ;      
 LED_EL   equ 2 ; (EN_SL) =P3.2=/INT0    HL4(EL)
              ; /    TL0
              ; ,   = 0
 LED_Tx   equ 1 ;  TxD     
              ;   = 0, 
 LED_Rx   equ 0 ;  RxD     
              ;   = 0, 
;  RXD  TXD      
; /  I2C / SPI     EEPROM
; (  SPI   IND_L=P3.3=/INT1 )

;
;------------------------------------------------------------------------
;
;   
;
;     
 bus_nc0  equ 0 ;  / 
 bus_nc1  equ 1 ;  / 
 bus_dtr  equ 2 ;  / 
        ;  reset      +5 
        ;       0
        ;       
				;     
 bus_clc  equ 3 ;    
        ;  reset/cold init      +5 
        ;    ()  ()
        ;   0
 bus_qt   equ 4 ;  
        ;  reset/cold init      +5 
        ;   0
        ;   ,   
 combas_3  equ 5 ;    ZIF 
        ;  reset      +5 
        ;   cold init    combas_3=0 
        ;   / 
        ;      3.3 89051
 combus_5  equ 6 ;    ZIF 
        ;  reset      +5 
        ;   cold init    combas_5=0 
        ;   / 
        ;      3.3 89051
 combus_7  equ 7 ;    ZIF 
        ;  reset      +5 
        ;   cold init    combas_7=0 
        ;   / 
        ;      3.3 89051
;    combus_4     PAVR
;        
;       
;  
;  "    "  PAVR
;
;------------------///////////////////-----------------------------------
;
;    trbspi_mb.txt
;
 .equ bits_ct = 8 ;   cntbit_t




;------------------///////////////////-----------------------------------
;
;       PAVR
;
 .equ cmd_read_hid = 0 ;    /  
       ;      
 .equ cmd_upg_on = 1 ;    +12 
       ;    
       ;   
 .equ cmd_upg_off = 2 ;    +12 
       ;    
       ;   
 .equ cmd_rezet_on = 3 ;    
       ;     ZIF  reset = 0
       ;   
 .equ cmd_rezet_off = 4 ;    
       ;     ZIF  reset = 1
       ;   
 .equ cmd_chip_erase = 5 ;  "    "
       ;        0FF 
			 ;    
			 ;   
 .equ cmd_rd_sign = 6 ;  " "  
       ;   clr_ptr_p
       ;       
 .equ cmd_rd_data = 7 ;  "     "
       ;   PGX051    (data_key=0)
       ;     data_key=1  ,
       ;        
       ; (  max_ptrh:max_ptrl = GPIOR0.pcnt_set =0)
       ;
       ;     "" -  
       ; 0x1000 - 0x1FFF   0x0000-0x0FFF
       ;      
       ;     0xFF  
 .equ cmd_purity = 8 ;  "  """
       ; (checking for purity)
       ;        
       ; cnt_erwl
       ; cnt_erwh -   
       ; erad_0l
       ; erad_0h  -    
       ; erdt_0   -    
       ;
       ;     data_key=1  
       ;      
       ;    
       ; (       max_ptrh:max_ptrl)
 .equ cmd_wrv_data = 9 ;  " "   
       ;    
       ;  
       ;       
       ;     max_ptrh:max_ptrl
       ;     
       ;
       ; 1.     data_key=1  
       ;     
       ;    
       ;         
       ;
       ; 2.     data_key=0
       ;     
       ;     max_ptrh:max_ptrl  
       ;        
       ; cnt_erwl
       ; cnt_erwh -   
       ; erad_0l
       ; erad_0h  -    
       ; erdt_0   -    
 .equ cmd_wr_lb1 = 10 ;  "   LB1"
       ;   
 .equ cmd_wr_lb2 = 11 ;  "   LB2"
       ;   
 .equ cmd_wr_hpcnt = 12 ;  "    PCNT"
       ;   
 .equ cmd_boot_key = 13 ;  "      ZIF "
       ;   
;
;______________________________________________________
;
;      (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  
;
;______________________________________________________
;
;    
;
; label: .ds expr (max 16 registers)
;
 bitmap: .ds 8 ; 8    
 flags:  .ds 8 ; 8     
              ;  64    00x40  0x7F
;______________________________________________________
;
;    
;    0x7F 
; label: .ds expr (max 80 registers)
;
; sys_reg:     .ds 9 ;     16 
 sys_tmp0:    .ds 1 ;
 sys_tmp1:    .ds 1 ;
 sys_tmp2:    .ds 1 ;
 sys_tmp3:    .ds 1 ;
 sys_tmp4:    .ds 1 ;
 sys_tmp5:    .ds 1 ;
 sys_tmp6:    .ds 1 ;
 sys_tmp7:    .ds 1 ;
 sys_tmp8:    .ds 1 ;
 cnts1:       .ds 1 ;   
 wtm1:        .ds 1 ;   
                 ;    0,01    
 sys_clokd:   .ds 2 ;    
                 ; sys_clokd=L, sys_clokd+1=H
 strg_ptr:    .ds 2 ;     
                ;  rs232 ()  
                ; strg_ptr=L,strg_ptr+1=H
 ctp_tx:      .ds 1 ;    
                ;   rs232 ()
                ;  
;
; --------------------   -----------------------------
;         
;      
;   bottle  mason_2.txt
;        2  16*2= 32 
 tmp0:   .ds 1
 tmp1:   .ds 1
 tmp2:   .ds 1
 tmp3:   .ds 1
 tmp4:   .ds 1
 tmp5:   .ds 1
 tmp6:   .ds 1
 tmp7:   .ds 1
 tmp8:   .ds 1
 tmp9:   .ds 1
 tmpa:   .ds 1
 tmpb:   .ds 1
 tmpc:   .ds 1
 tmpd:   .ds 1
 tmpe:   .ds 1
 tmpf:   .ds 1

; --------------------   -----------------------------
;        
;
 .define test_dat tmp0
;
 .define  boot_adr tmp0 ;   .ds 2 ;  -  
                ;     *.xeh 
                ; boot_adr=L, boot_adr+1=H
 .define  map_adr tmp2  ;    .ds 2 ;     
                ; map_adr=L,map_adr+1=H
 .define  cnt_byts tmp4 ;   .ds 1 ;     
 .define  cb_total tmp5 ;   .ds 1 ;  
 .define  h_tetras tmp6 ;   .ds 1 ;    
                ;  ASCII   
 .define  tmp_rx tmp7 ;     .ds 1 ;    
 .define  step_ptr tmp8 ;   .ds 2 ;    
                ;    
                ; step_ptr=L,step_ptr+1=H
; seg_adr:    .ds 2 ;  
; lin_adr:    .ds 2 ;  
;
;-------------- ----------------- --------------------
;
;          tmp0 - tmpf

 .define  pavr_port	P1 ;    = 1
;
;------------------///////////////////-----------------------------------
;
;     trbspi_mb.txt (  0)
; 
 .define cntbit_t (rbt0+2) ; r2 rb0  
 .define cnt_tm (rbt0+3) ; r3 rb0   
 .define data_t (rbt0+7) ; r7 rb0   
;
 .define max_ptrl sys_tmp0 ;     
                       ;  
 .define max_ptrh sys_tmp1 ;     
                       ;  
 .define pcntl sys_tmp2 ;    PCNT
                 ;  
 .define pcnth sys_tmp3 ;    PCNT
                 ;  
 .define cnt_erwl sys_tmp4 ;   
                 ;   ,  
 .define cnt_erwh sys_tmp5 ;   
                 ;   ,  
 .define erdt_0 sys_tmp6 ;    







;
;----------------------------------------------------------------
;    work_reg - ramend     
;  bottle
; work_reg:  .ds 48 ;     

;
;----------------------------------------------------------------
;
;    -   
;
;         
; ( flags - flags+8)
; label: .dbit expr
;
   .BSEG at ((flags-bitmap)*8) ;     (.bseg at 0xnn)
 sys_tic1:  .dbit 1 ;   1    
 wtm1_tic:  .dbit 1 ;    WTM1
 en_wtm1:   .dbit 1 ;    WTM1
 ap_fill:   .dbit 1 ;    \
                   ;   
 preof_ldr: .dbit 1 ;    
 eof_ldr:   .dbit 1 ;  "  "
 eof_txd:   .dbit 1 ;  "   "
 glob_er:   .dbit 1 ;  " "

;
;----------------------------------------------------------------
;
;        ( 56 )
;
;
;     trbspi_mb.txt
;
 data_key: .dbit 1 ;   /
           ; data_key=0 -   
           ; data_key=1 -   
;
 arrey_end: .dbit 1 ; 
          ; "    "
 pcnt_set: .dbit 1 ; 
          ;"    "

;
;----------------------------------------------------------------
;    
;   XSEG
;
;     (.xseg at 0xnnnn)
;   
; "  " ""
;
   .xseg at 0xFF00 
 glob_systap: .ds 240


   .xseg at 0xFFF0
 key_proc:    .ds 15


   .xseg at 0x0000
 wr_dump: .ds 4096 ;     
 rd_dump: .ds 4096 ;     
 ;     16-1024 
 cmd_dump: .ds 16
 reinfo_d: .ds 256 ;     
          ; 
;
;----------------------------------------------------------------
;
;