;
;
;                    rd_sign.txt
;
;    
;
;     
;
;      PGX051
;   rd_sign.hex
;
;------------------------------------------------------------
;   #cmd_rd_sign (upgm_m0.txt)
;
 rd_sign:
     ELL_ON
     LLPRINT reinfo ;    
     setb data_key ;   data_key=1
     mov data_t,#cmd_rd_sign ;     R7
     anl P1,#low ~(1<<combas_3 || 1<<combus_5 || 1<<combus_7)
		      ;  combas_3=combus_5=combus_7=0 
		      ; * c51asm   "~"   *
     acall pspi_txd ;  
     acall transl ;   
      LLPRINT rd_ss0 ; first byte of the signature
      LLPRINT rd_ss2
			 LLPRINT reinfo ;
     acall transl ;   
     LLPRINT rd_ss1 ; second byte of the signature
     LLPRINT rd_ss2
			 LLPRINT reinfo ;
        orl P1,#(1<<combas_3 || 1<<combus_5 || 1<<combus_7)
				 ;  combas_3=combus_5=combus_7=1
		 ELL_OFF
		ajmp res_user ;       
;
;------------------------------------------------------------
;       ASCII
;  ,    R7(data_t)
;      ASCII, 
;   
; R7 =    
; R6 =   
;
 hex_asc:
     push dph
     push dpl
		 mov dptr,#kodas
		 mov a,r7
     anl a,#0x0F
     movc a,@a+dptr
     mov r6,a
     mov a,r7
     swap a
     anl a,#0x0F
     movc a,@a+dptr
     mov r7,a
     pop dpl
     pop dph
    ret
;
;------------------------------------------------------------
;
 transl:
      acall pspi_rxd
      mov dptr,#reinfo
 lou_trans1:
			acall hex_asc
      mov a,r7
      movx @dptr,a
      inc dptr
      mov a,r6
      movx @dptr,a
      inc dptr
      mov a,#"\r"
      movx @dptr,a
      inc dptr
      mov a,#"\n"
      movx @dptr,a
      inc dptr
      clr a
      movx @dptr,a
    ret
;
;------------------------------------------------------------
;
 rd_ss0:
  .db "\r\n first ",0 ; \r\n
 rd_ss1:
  .db "\r\n second ",0 ; \r\n
 rd_ss2:
  .db "byte of the signature \r\n",0 ; 
;