FILTER4:
MOV R6,#40H
MOV R2,#00H
MOV R3,#00H
MOV A,COUNT
PUSH ACC
MOV R0,#DATA
LOOP:
MOV 36H,R6
MOV 37H,R2
MOV 38H,R3
MOV A,@R0
MOV R3,A
INC R0
MOV R1,#MED1
CLR 3AH
INTF:
MOV R6,#10H
SETB C
CLR PSW.5
FSDT:
JC LOOP2
MOV C,39H
JB PSW.5,LOOP1
MOV A,R2
RRC A
MOV R2,A
MOV A,R3
RRC A
MOV R3,A
INC R6
LOOP1:
MOV A,R4
RRC A
MOV R4,A
MOV A,R5
RRC A
MOV R5,A
INC R7
LOOP2:
MOV A,R2
JNZ LOOP4
CJNE R3,#0,LOOP5
MOV R6,#41H
LOOP3:
RET
LOOP4:
JB ACC.7,LOOP3
LOOP5:
MOV C,PSW.5
MOV A,R3
RLC A
MOV R3,A
MOV A,R2
RLC A
MOV R2,A
CLR PSW.5
DEC R6
SJMP LOOP2
MOV A,R6
MOV C,3CH
MOV ACC.7,C
MOV R4,A
MOV A,R4
MOV @R1,A
INC R1
MOV A,R2
MOV @R1,A
INC R1
MOV A,R3
MOV @R1,A
DEC R1
DEC R1
RET
MOV A,@R1
MOV R7,A
INC R1
MOV A,@R1
MOV R4,A
INC R1
MOV A,@R1
MOV R5,A
DEC R1
DEC R1
MOV R6,36H
MOV R2,37H
MOV R3,38H
CLR 3AH
MOV A,R6
MOV C,ACC.7
MOV 38H,C
XRL A,R7
JNB ACC.7,LOOP6
CPL 3AH
MOV A,R6
MOV C,ACC.6
MOV ACC.7,C
MOV R6,A
MOV A,R7
MOV C,ACC.6
MOV ACC.7,C
MOV R7,A
CLR C
MOV A,R6
SUBB A,R7
JZ LOOP7
CLR PSW.5
CLR 39H
JB ACC.7,LOOP10
CJNE R4,#0,LOOP11
CJNE R5,#0,LOOP11
LOOP7:
JB 3AH,LOOP13
MOV A,R3
ADD A,R5
MOV R3,A
MOV A,R2
ADDC A,R4
MOV R2,A
JNC LOOP9
SETB 39H
CLR C
LOOP8:
CLR PSW.5
LCALL FSDT
LOOP9:
CJNE R2,#0,FAB
CJNE R3,#0,FAB
MOV R4,#41H
RET
FAB:
MOV A,R6
MOV C,38H
MOV ACC.7,C
XCH A,R4
MOV R6,A
RET
LOO10:
CJNE R2,#0,LOOP12
CJNE R3,#0, LOOP12
MOV A ,R7
MOV R6,A
SJMP LOOP7
LOOP11:
CPL PSW.5
LOOP12:
CLR C
LCALL FSDT
SJMP LOOP6
LOOP13:
MOV A,R3
CLR C
SUBB A,R5
MOV R3,A
MOV A,R2
SUBB A,R4
MOV R2,A
JNC LOOP14
CLR A
CLR C
SUBB A,R3
MOV R3,A
CLR A
SUBB A,R2
MOV R2,A
CPL 38H
LOOP14:
SETB C
SJMP LOOP8
MOV A,R4
MOV R6,A
DJNZ COUNT,LOOP
MOV A,R4
MOV @R1,A
INC R1
MOV A,R2
MOV @R1,A
INC R1
MOV A,R3
MOV @R1,A
DEC R1
DEC R1
RET
POP ACC
MOV R2,#00H
MOV R3,A
MOV A,#MED2
XCH A,R1
MOV R0,A
CLR 3CH
LCALL INTF
FDIV:
INC R0
MOV A,@R0
INC R0
ORL A,@R0
DEC R0
DEC R0
JNZ DIV1
MOV @R0,#41H
CLR OV
RET
DIV1:
INC R1
MOV A,@R1
INC R1
ORL A,@R1
DEC R1
DEC R1
JNZ DIV2
SETB OV
RET
DIV2:
LCALL MVR0
MOV A,@R0
XRL A,@R1
RLC A
MOV 1FH,C
LCALL MVR1
LCALL DIV3
LJMP MOV0
DIV3:
CLR C
MOV A,R4
SUBB A,R7
MOV A,R3
SUBB A,R6
JC DIV4
LCALL RR1
SJMP DIV3
DIV4:
CLR A
XCH A,R0
PUSH ACC
CLR A
XCH A,R1
PUSH ACC
MOV A,R2
PUSH ACC
MOV B,#10H
DIV5:
CLR C
MOV A,R1
RLC A
MOV R1,A
MOV A,R0
RLC A
MOV R0,A
MOV A,R4
RLC A
MOV R4,A
XCH A,R3
RLC A
XCH A,R3
MOV F0,C
CLR C
SUBB A,R7
MOV R2,A
MOV A,R3
SUBB A,R6
ANL C,/F0
JC DIV6
MOV R3,A
MOV A,R2
MOV R4,A
INC R1
DIV6:
DJNZ B,DIV5
MOV A,R6
CLR C
RRC A
SUBB A,R3
CLR A
ADDC A,R1
MOV R4,A
CLR A
ADDC A,R0
MOV R3,A
POP ACC
MOV R2,A
POP ACC
MOV R1,A
POP ACC
MOV R0,A
MOV A,R2
CLR C
SUBB A,R5
LCALL MD
LJMP RLN
MOV A,R0
MOV R1,A
MOV A,R4
MOV @R1,A
INC R1
MOV A,R2
MOV @R1,A
INC R1
MOV A,R3
MOV @R1,A
DEC R1
DEC R1
RET
DATA EQU 20H
MED1 EQU 30H
MED2 EQU 33H
COUNT EQU 38H