ASCTOBCD:
MOV R7,# 06H
MOV R1,# 20H
MOV R0,#20H
ACALL ASCBCD
LOOP:
SJMP LOOP
ASCBCD:
MOV A,@R0
CLR C
CJNE A,#30H,LOOP1
LOOP1:
JC C, LOOP3
CJNE A,#3AH,LOOP2
LOOP2:
JNC C, LOOP4
CLR C
SUBB A, # 30H
LOOP3:
MOVX @R1,A.
INC R0
INC R1
DJNZ R7,ASCBCD
RET
LOOP4:
MOV A,#0FFH
MOVX @R1,A
LJMP LOOP3
RET