DODIV:
MOV A,R0
MOV R4, A
MOV A, R1
MOV R5, A
MOV A, R3
MOV R7, A
MOV A, R0
ADD A, R3
MOV R6,A
MOV R1, A
LP0:
MOV @R1,#00H
INC R1
DJNZ R3, LP0
MOV A,R7
ADD A, R7
MOV R2, A
MOV B, #04H
MUL AB
LP1:
PUSH A
MOV A, R2
MOV R3, A
MOV A, R4
MOV R1, A
CLR C
LP2:
MOV A,@R1
RLC A
MOV @R1, A
INC R1
DJNZ R3, LP2
NEXT:
MOV A, R6
MOV R0, A
MOV A, R5
MOV R1, A
MOV A, R7
MOV R3, A
CLR C
LP3:
MOV A,@R0
SUBB A,@R1
PUSH A
INC R0
INC R1
DJNZ R3, LP3
MOV A, R7
MOV R3, A
JC SMALL
MOV A, R4
MOV R0, A
INC @R0
MOV A, R6
ADD A, R7
DEC A
MOV R0, A
LP4:
POP A
MOV @R0, A
DEC R0
DJNZ R3, LP4
SJMP NEXT
SMALL:
POP A
DJNZ R3, SMALL
POP A
DEC A
JNZ LP1
I504:
MOV A,R6
ADD A, R7
DEC A
MOV R0, A
MOV R2, A
MOV A,@R0
JB E7H, ADD1
MOV A, R6
MOV R1, A
MOV A, R7
MOV R3, A
CLR C
LP5:
MOV A,@R1
RLC A
MOV @R1, A
INC R1
DJNZ R3, LP5
MOV A, R2
MOV R0, A
MOV A, R7
MOV R3, A
ADD A, R5
DEC A
MOV R1, A
LP6:
CLR C
MOV A,@R0
SUBB A,@R1
JC RETURN
JNZ ADD1
DEC R0
DEC
DJNZ R3, LP6
ADD1:
MOV A,R4
MOV R1, A
MOV A, R7
MOV R3, A
SETB C
LP7l:
MOV A,@R1
ADDC A, #00H
MOV @R1, A
DJNZ R3, LP7
RETURN:
MOV A,R4
MOV R0, A
MOV A, R7
MOV R3, A
RET