;
;
;                    purity.txt
;
;    
;
;  "  """ (checking for purity)
;        
; cnt_erwl
; cnt_erwh -   
; erad_0l
; erad_0h  -    
; erdt_0   -    
;
;     data_key=1  
;      
;    
; (       max_ptrh:max_ptrl)
;
;      PGX051
;   purity.hex
;
;------------------------------------------------------------
;
;  "  """
;   #cmd_purity (upgm_m0.txt)
;
 purit:
     anl P1,#low ~(1<<combas_3)
     orl P1,#(1<<combus_5 || 1<<combus_7)
		      ;  combas_3=0, combus_5=combus_7=1 
     ELL_ON
     LLPRINT reinfo ;    
     setb data_key ;   data_key=1
     mov data_t,#cmd_purity ;     R7
     acall pspi_txd ;  
 end_verif:
     clr data_key ;  data_key=0
     acall pspi_rxd ;     
     jnb data_key,norm_end
     ELL_OFF ;   -   
            ;  
     LLPRINT str4 ; "load maximum address of the
	             ; array ROM and repeat command"
    ajmp res_user ;       
   norm_end:
     mov tmpa,data_t ;      tmp0
     acall pspi_rxd ;
     mov tmpb,data_t ;      tmp1
     acall pspi_rxd ;
     mov tmpc,data_t ;        tmp2
     acall pspi_rxd ;
     mov tmpd,data_t ;        tmp3
     acall pspi_rxd ;
     mov tmpe,data_t ;       tmp4
     LLPRINT str3 ;"is it successfully executed"
		        ;     
		 orl P1,#(1<<combas_3 || 1<<combus_5 || 1<<combus_7)
				 ;  combas_3=combus_5=combus_7=1
		 mov dptr,#reinfo
		 mov data_t,tmpb ;    
		 acall lou_trans0
		 mov data_t,tmpa ;    
		 acall lou_trans1 ; (rd_sign.txt)
		 LLPRINT str5 ; "error counter = 0x"
		 LLPRINT reinfo
		 mov a,tmpa ;    
		 jnz pur_er
		 mov a,tmpb ;    
		 jnz pur_er
		 sjmp pur_nom
	pur_er:
		 mov dptr,#reinfo
		 mov data_t,tmpd ;      
		 acall lou_trans0
		 mov data_t,tmpc ;      
		 acall lou_trans1 ; (rd_sign.txt)
		 LLPRINT str6 ; "address first met mistakes = 0x"
		 LLPRINT reinfo
		 mov dptr,#reinfo
		 mov data_t,tmpe
		 acall lou_trans1 ; (rd_sign.txt)
		 LLPRINT str7 ; "data first met mistakes = 0x"
		 LLPRINT reinfo
 pur_nom:
    ELL_OFF
   ajmp res_user ;      () 
;
 lou_trans0:
      acall hex_asc ; (rd_sign.txt)
      mov a,r7
      movx @dptr,a
      inc dptr
      mov a,r6
      movx @dptr,a
      inc dptr
    ret
;