FTOBCD:
INC R0
MOV A,@R0
INC R0
ORL A,@R0
DEC R0
DEC R0
JNZ FTB0
MOV @R0,#41H
RET
FTBCD0:
MOV A,@R0
MOV C,ACC.7
MOV 1DH,C
CLR ACC.7
MOV @R0,A
LCALL MVR0
MOV DPTR,#BFL0
MOV B,#0
MOV A,R2
JNB ACC.7,FTB1
MOV DPTR,#BTFL
MOV B,#0EDH
ADD A,#16
JNC FTBCD1
MOV DPTR,#BFLN
MOV B,#0FAH
FTBCD1:
CLR A
MOVC A,@A+DPTR
MOV C,ACC.6
MOV ACC.7,C
MOV R5,A
MOV A,#1
MOVC A,@A+DPTR
MOV R6,A
MOV A,#2
MOVC A,@A+DPTR
MOV R7,A
MOV A,R5
CLR C
SUBB A,R2
JB ACC.7,FTB2
JNZ FTBCD3
MOV A,R6
CLR C
SUBB A,R3
JC FTBCD2
JNZ FTBCD3
MOV A,R7
CLR C
SUBB A,R4
JC FTBCD2
JNZ FTBCD3
MOV R5,B
INC R5
MOV R6,#10H
MOV R7,#0
SJMP FTBCD6
FTBCD2:
INC DPTR
INC DPTR
INC DPTR
INC B
SJMP FTBCD1 ;
FTBCD3:
PUSH B
LCALL DIV3
FTB4:
MOV A,R2
JZ FTBCD5
CLR C
LCALL RR1
SJMP FTBCD4
FTB5:
POP ACC
MOV R5,A
LCALL HBCD2
MOV R6,A
LCALL HBCD2
MOV R7,A
MOV A,R3
RLC A
CLR A
ADDC A,R7
DA A
MOV R7,A
CLR A
ADDC A,R6
DA A
MOV R6,A
JNC FTBCD6
MOV R6,#10H
INC R5
FTBCD6:
INC R0
INC R0
MOV A,R7
MOV @R0,A
DEC R0
MOV A,R6
MOV @R0,A
DEC R0
MOV A,R5
MOV C,1DH
MOV ACC.7,C
MOV @R0,A
RET
HBCD2:
MOV A,R4
MOV B,#100
MUL AB
MOV R4,A
MOV A,B
XCH A,R3
MOV B,#100
MUL AB
ADD A,R3
MOV R3,A
JNC HBCD21
INC B
HBCD21:
MOV A,B
MOV B,#10
DIV AB
SWAP A
ORL A,B
RET