PersonalCorpus 版 (精华区)
入口: R0(BCD 码高位字节地址指针);R7 (BCD 码字节数)
出口: R1(无符号二进制整数低位字节地址指针)
BCDMB: MOV A,R1
MOV R6,A
MOV A,R7
MOV R3,A
CLR A
CLBIN: MOV @R1,A
INC R1
DJNZ R3,CLBIN
MOV A,R7
MOV R3,A
LP: LCALL MU10
MOV A,@R0
ANL A,#0F0H
SWAP A
LCALL SUM
LCALL MU10
MOV A,@R0
ANL A,#0FH
LCALL SUM
DEC R0
DJNZ R3,LP
MOV A,R6
MOV R1,A
MOV R0,20H
MOV R1,21H
MOV R2,22H
RET
MU10: MOV A,R7
MOV R4,A
MOV A,R6
MOV R1,A
CLR C
MOV R2,#00H
LP1: MOV A,@R1
MOV B,#0AH
PUSH PSW
MUL AB
POP PSW
ADDC A,R2
MOV @R1,A
MOV R2,B
INC R1
DJNZ R4,LP1
RET
SUM: MOV R5,A
MOV A,R6
MOV R1,A
MOV A,R2
MOV R4,A
DEC R4
MOV A,R5
ADD A,@R1
MOV @R1,A
INC R1
MOV A,R4
JNZ LP2
SJMP LP3
LP2: MOV A,@R1
ADDC A,#00H
MOV @R1,A
INC R1
DJNZ R4,LP2
LP3: RET
;
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:3.267毫秒