经典算法用 BCD 加法:
; R7:R6 ==> R5:R4:R3
CLR A
MOV R3, A
MOV R4, A
MOV R5, A
MOV R2, #16 ; 16 BIT TO CONVERT
MOV A, R6
MOV B, R7 ; B:A
LP1:
RLC A
XCH A, B
RLC A
XCH A, B
XCH A, R3
ADDC A, ACC
DA A
XCH A, R3
XCH A, R4
ADDC A, ACC
DA A
XCH A, R4
XCH A, R5
ADDC A, ACC
DA A
XCH A, R5
DJNZ R2, LP1
RET |