SDODIV:
MOV 21H,R0
MOV A, R0
ADD A, R3
DEC A
MOV R0, A
MOV A,@R0
ANL A, #80H
MOV R6, A
JZ NEG1
NEG0:
MOV R0,21H
MOV 22H, R3
ACALL NEGTUN
NEG1:
MOV 24H,R1
MOV A, R1
ADD A, R2
DEC A
MOV R1, A
MOV A,@R1
ANL A, #80H
MOV R7, A
JZ ZERO
MOV R0,24H
MOV 22H, R2
ACALL NEGTUN
ZERO:
MOV A, 24H
ADD A, R2
MOV R0, A
MOV A, R3
CLR C
SUBB A, R2
MOV R2, A
JZ DODIV
LP:
MOV @R0,#00H
INC R0
DJNZ R2, LP
DDODIV:
MOV A,R6
XRL A, R7
MOV 23H, A
MOV R0, 21H
MOV R1, 24H
ACALL DODIV
JNB 1FH, RETURN
NEG2:
MOV 22H,R3
ACALL NEGTUN
MOV R0, 21H
RETURN:
RET
NEGTUN:
SETB C
LP:
MOV A,@R0
CPL A
ADDC A, #00H
MOV @R0, A
INC R0
DJNZ 22H, LP
RET