;==========================================
有谁知道双字节除以单字节得单字节商的汇编程序,R1R0 / R2 = R3
悬赏分:5 - 解决时间:2009-8-19 22:22
;==========================================
最佳答案:;R1R0 / R2 --> R3 ORG 0000H MOV R1, #12H
MOV R0, #34H
MOV R2, #78H CALL R10_DIV_R2_TO_R3
;R3 = 26H
NOP
SJMP $R10_DIV_R2_TO_R3:
MOV R3, #0
_D1:
CLR C
MOV A, R0
SUBB A, R2
MOV R0, A
MOV A, R1
SUBB A, #0
MOV R1, A
JC _D2
INC R3
SJMP _D1
_D2:
RET
END
;==========================================
回答者:做而论道 - 二级 2009-8-9 22:38
提问者对于答案的评价:谢谢
原题网址:
http://zhidao.baidu.com/question/110781210.html;==========================================后记:上述程序,没有计算余数,因为题目没有这个要求。
如果要计算余数,程序如下:;R1R0 / R2 --> R3 ... R0
ORG 0000H MOV R1, #12H
MOV R0, #34H
MOV R2, #78H CALL R10_DIV_R2_TO_R3 ;R3 = 26H, R0 = 64H NOP
SJMP $R10_DIV_R2_TO_R3:
MOV R3, #0
_D1:
CLR C
MOV A, R0
SUBB A, R2
MOV B, A
MOV A, R1
SUBB A, #0
JC _D2 INC R3
MOV R0, B
MOV R1, A
SJMP _D1
_D2:
RET
END
;==========================================