BCD整数转换为二进制整数(3位)
;入口:R0(高位地址),N位数;出口:R2,R3,R4
;占用资源:ACC,B;堆栈需求:2字节
IPP3: MOV R7,N
CLR A
MOV R2,A
MOV R3,A
MOV R4,A
IPP31: MOV A,R4
MOV B,#0AH
MUL AB
MOV R4,A
MOV A,B
XCH A,R3
MOV B,#0AH
MUL AB
ADD A,R3
MOV R3,A
CLR A
ADDC A,B
XCH A,R2
MOV B,#0AH
MUL AB
ADD A,R2
MOV R2,A
MOV A,R4
ADD A,@R0
INC R0
MOV R4,A
CLR A
ADDC A,R3
MOV R3,A
CLR A
ADDC A,R2
MOV R2,A
DJNZ R7,IPP31
RET |