;
;         "dfn_ios_mb.txt"    ,    ()
;
;------------------------------------------------------
; variable definitions
;(  )
;______________________________________________________
;   -  
;
; label equ expr
;
; ***---*** {     bios b52m & kotios
 set_vect_tbl  equ 0x00A9 ; (0x00C6)    set_vect_tbl 
 bottle        equ 0x00C0 ; (0x00E7)    bottle 
 proc_txd_init equ 0x0295 ; (0x02C7)    proc_txd_init 
 proc_txd      equ 0x029A ; (0x02CC)    proc_txd 
 soft_reset    equ 0x0057 ;    soft_reset 

;--------------------------------------------------------------
;
 startus equ 0x8000 ;    
;             0x2000 - 0x8000    0xFBFF
;      
;

 com_string   equ 0xFC00 ;     kotios
    ;       
    ;      ljmp #addr
    ;     com_string:com_string+1:com_string+2
 key_proc      equ 0xFFF0 ;    
                      ;   0x0000-0xnnnn  
                      ; (  key_proc )
;-------------------------------------------------------------
;
 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 
 
 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
 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 )
;     } ***---***
;
;------------------------------------------------------------------------
;
;   
;           <<<< { 

 trd_mask equ (1<<bus_clc || 1<<bus_qt || 1<<bus_dtr)

 bus_dtr  equ 5 ;  / 
        ;  reset      +5 
        ;       0
        ;       
				;     
 bus_clc  equ 3 ;    
        ;  reset/cold init      +5 
        ;    ()  ()
        ;   0
 bus_qt   equ 4 ;  
        ;  reset/cold init      +5 
        ;   0
        ;   ,   
 Pg_reset equ 7 ;     9
        ; ZIF- (reset     
        ; )
        ; ,    mcs51=1
 Pg_P3_0  equ 6 ;    10 ZIF-
        ; 3.0      
        ; ,    ,
        ;   ZIF-
 Pg_prog  equ 2 ;     30
        ; ZIF- (ALE/PROG     
        ; )
        ; ,    ,
        ;   ZIF-
 Com_Key  equ 1 ;   , 
        ;   MB4012
        ;   = 0,   
 Pg_EVpp  equ 0 ;   
        ;  Vpp - Pg_EVpp=0  
        ; +12    31 ZIF- (EA/Vpp
        ;  )
        ;  Pg_EVpp=1   31 ZIF- +5  !!1
;
; smart_vectors equ 0x0100 ;   
        ;  
;
;------------------------------------------------------------------
;             -
;   128   "" 
;
RD_Pfb0   equ 0b00000000 ;     0
                   ;  1  
WR_Pfb0   equ 0b00000010 ;     0
                   ;    smart_qt
Wbm1_Pfb0 equ 0b00000100 ;    
                   ;       0
                   ;    smart_qt
Wbm0_Pfb0 equ 0b00000110 ;    
                   ;       0
                   ;    smart_qt
RD_Pfb1   equ 0b00001000 ;     1
                   ;  1  
WR_Pfb1   equ 0b00001010 ;     1
                   ;    smart_qt
Wbm1_Pfb1 equ 0b00001100 ;    
                   ;       1
                   ;    smart_qt
Wbm0_Pfb1 equ 0b00001110 ;    
                   ;       1
                   ;    smart_qt
RD_Pfb2   equ 0b00010000 ;     2
                   ;  1  
WR_Pfb2   equ 0b00010010 ;     2
                   ;    smart_qt
Wbm1_Pfb2 equ 0b00010100 ;    
                   ;       2
                   ;    smart_qt
Wbm0_Pfb2 equ 0b00010110 ;    
                   ;       2
                   ;    smart_qt
RD_Pfb3   equ 0b00011000 ;     3
                   ;  1  
WR_Pfb3   equ 0b00011010 ;     3
                   ;    smart_qt
Wbm1_Pfb3 equ 0b00011100 ;    
                   ;       3
                   ;    smart_qt
Wbm0_Pfb3 equ 0b00011110 ;    
                   ;       3
                   ;    smart_qt
;------------------------------------------------------------------
Read_Hed equ 0b00100000 ; 
                   ;   
                   ;  11  
;------------------------------------------------------------------
Oll_Pfb_on   equ 0b00100010 ; 
                   ;     0xFF
                   ;    smart_qt
Oll_Pfb_off  equ 0b00100100 ; 
                   ;     0x00
                   ;    smart_qt
;------------------------------------------------------------------
Inc_Pfb0 equ 0b00100110 ;   0
                  ;    smart_qt
Inc_Pfb1 equ 0b00101000 ;   1
                  ;    smart_qt
Inc_Pfb2 equ 0b00101010 ;   2
                  ;    smart_qt
Inc_Pfb3 equ 0b00101100 ;   3
                  ;    smart_qt
;-------------------------------------------------
Dec_Pfb0 equ 0b00101110 ;   0
                  ;    smart_qt
Dec_Pfb1 equ 0b00110000 ;   1
                  ;    smart_qt
Dec_Pfb2 equ 0b00110010 ;   2
                  ;    smart_qt
Dec_Pfb3 equ 0b00110100 ;   3
                  ;    smart_qt
;-------------------------------------------------
Clr_Pfb0 equ 0b00110110 ;  000   0
                  ;    smart_qt
Clr_Pfb1 equ 0b00111000 ;  000   1
                  ;    smart_qt
Clr_Pfb2 equ 0b00111010 ;  000   2
                  ;    smart_qt
Clr_Pfb3 equ 0b00111100 ;  003   3
                  ;    smart_qt
;-------------------------------------------------
Set_Pfb0 equ 0b00111110 ;  0FF   0
                  ;    smart_qt
Set_Pfb1 equ 0b01000000 ;  0FF   1
                  ;    smart_qt
Set_Pfb2 equ 0b01000010 ;  0FF   2
                  ;    smart_qt
Set_Pfb3 equ 0b01000100 ;  0FF   3
                  ;    smart_qt
;-------------------------------------------------
Cpl_Pfb0 equ 0b01000110 ;     0
                  ;    smart_qt
Cpl_Pfb1 equ 0b01001000 ;     1
                  ;    smart_qt
Cpl_Pfb2 equ 0b01001010 ;     2
                  ;    smart_qt
Cpl_Pfb3 equ 0b01001100 ;     3
                  ;   3  3   1
                  ;    smart_qt
;------------------------------------------------------------------


;            } >>>>
;
;______________________________________________________
;
;      (0x00-0x7F)
;
; label: .ds expr
;
; ***---*** {     bios b52m & kotios
  .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)
;
; ***---*** {     bios b52m & kotios
 bitmap: .ds 8 ; 8    
 flags:  .ds 8 ; 8     
              ;  64    00x40  0x7F
;     } ***---***
;______________________________________________________
;
;    
;    0x7F 
; label: .ds expr (max 80 registers)
;
; ***---*** {     bios b52m & kotios
; 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 ;
 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 ()
                ;  
 tmp_rx:      .ds 1 ;    
 step_ptr:    .ds 2 ;    
                ;    
                ; step_ptr=L,step_ptr+1=H
;     } ***---***
;
; --------------------   -----------------------------
;         
;      
;   bottle  mason_2.txt
;        2  16*2= 32 
; ***---*** {     bios b52m & kotios
 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
;     } ***---***
;
; --------------------   -----------------------------
;        
;
; ***---*** {     bios b52m & kotios
 .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   

; seg_adr:    .ds 2 ;  
; lin_adr:    .ds 2 ;  
;     } ***---***
;
;-------------- ----------------- --------------------
;
;        
;           <<<< { 

;    
;       bspi
 .define cntbit_t R2 ; r2 rb0  
 .define cnt_tm R3 ; r3 rb0   
 .define data_t R7 ; r7 rb0   
 .define txd_port P1 ; 1   /  
 .define linc_port P1 ; 1   

 .define g_cnt sys_tmp5


;            } >>>>
;
;
;----------------------------------------------------------------
;    work_reg - ramend     
;  bottle
; work_reg:  .ds 48 ;     
;           <<<< { 




;            } >>>>
;
;----------------------------------------------------------------
;
;    -   
;
;         
; ( flags - flags+8)
; label: .dbit expr
;
; ***---*** {     bios b52m & kotios
   .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 )
;
;
;           <<<< { 

 data_key: .dbit 1 ;   /
           ; data_key=0 -   
           ; data_key=1 -   
 test_key: .dbit 1 ;     
 fts0:     .dbit 1 ;  -


;            } >>>>

;
;----------------------------------------------------------------
;    
;   XSEG
;
;   
; "  " ""
;
; ***---*** {    

  .xseg at 0xFF00
 sys_tap:
  .ds 256

;     } ***---***
;
;----------------------------------------------------------------
;
;