双字节无符号除法程序 (R5R2R3R4/R6R7)=(R2)R3R4 余数R6R7汇编
- UID
- 1023166
- 性别
- 男
- 来自
- 燕山大学
|
双字节无符号除法程序 (R5R2R3R4/R6R7)=(R2)R3R4 余数R6R7汇编
入口 :R5,R2,R3,R4,R6,R7
;占用资源:ACC,B,F0
;堆栈需求:4字节
;出口 R2),R3,R4,R6,R7,OV
NDIV42 :MOV A,R1
PUSH A
MOV B,#00H
NDV421 :MOV A,R2
CLR C
SUBB A,R7
MOV R1,A
MOV A,R5
SUBB A,R6
JC NDV422
MOV R5,A
MOV A,R1
MOV R2,A
INC B
SJMP NDV421
NDV422 USH B
MOV B,#10H
NDV423 :CLR C
MOV A,R4
RLC A
MOV R4,A
MOV A,R3
RLC A
MOV R3,A
MOV A,R2
RLC A
MOV R2,A
XCH A,R5
RLC A
XCH A,R5
MOV F0,C
CLR C
SUBB A,R7
MOV R1,A
MOV A,R5
SUBB A,R6
JB F0,NCV424
JC NDV425
NCV424 :MOV R5,A
MOV A,R1
MOV R2,A
INC R4
NDV425 JNZ B,NDV423
POP A
CLR OV
JNZ NDV426
SETB OV
NDV426 :XCH A,R2
MOV R7,A
MOV A,R5
MOV R6,A
POP A
MOV R1,A
RET |
|
|
|
|
|