ORG 1000H
OVER DATA 2FH
DUDIV:
MOV A,R7
JNZ START
MOV A,R6
JZ ERROR
START:
MOV A,R5
JNZ START1
MOV A,R4
JNZ START1
RET
START1:
CLR A
MOV R2,A
MOV R3,A
MOV R1,#16
DIV0:
CLR C
MOV A,R4
RLC A
MOV R4,A
MOV A,R5
RLC A
MOV R5,A
MOV A,R2
RLC A
MOV R2,A
MOV A,R3
RLC A
MOV R3,A
MOV A,R2
SUBB A,R6
JC NEXT
INC R4
MOV R3,A
MOV A,R0
MOV R2,A
NEXT:
DJNZ R1,DIV0
MOV A,R3
JB ACC.7,ROUND
MOV A,R2
RLC A
MOV R2,A
MOV A,R3
RLC A
SUBB A,R7
JC DONE
JNZ ROUND
MOV A,R2
SUBB A,R6
JC DONE
ROUND:
MOV A,R4
ADD A,#1H
MOV R4,A
MOV A,R5
ADDC A,#0H
MOV R5,A
DONE:
MOV OVER,#0H
RET
ERROR:
MOV OVER,#0FFH
RET