作者:matrix shake
链接:https://www.zhihu.com/question/26134223/answer/32330410
来源:知乎
著作权归作者所有,转载请联系作者获得授权。
三字节除法,若要扩展长度,修改循环位移减法次数即可
DV31:
CLR C
MOV A,R3
SUBB A,R7
JC DV30
SETB OV
RET
DV30:
MOV R2,#10H ;求R3R4R5/R7-→R4R5
DM23:
CLR C
MOV A,R5
RLC A
MOV R5,A
MOV A,R4
RLC A
MOV R4,A
MOV A,R3
RLC A
MOV R3,A
MOV F0,C
CLR C
SUBB A,R7
ANL C,/F0
JC DM24
MOV R3,A
INC R5
DM24:
DJNZ R2,DM23
MOV A,R3
ADD A,R3
JC DM25
SUBB A,R7
JC DM26
DM25:
INC R5
MOV A,R5
JNZ DM26
INC R4
DM26:
CLR OV
RET
用C语言写