FEXP: MOV R5,#1 MOV R6,#0B8H MOV R7,#0ABH ;加权系数为正数 MOV A,@R0 MOV C,ACC.7 MOV 1FH,C MOV C,ACC.6 MOV ACC.7,C MOV R2,A INC R0 MOV A,@R0 MOV R3,A INC R0 MOV A,@R0 MOV R4,A DEC R0 DEC R0 LCALL MUL1 CLR 1EH MOV A,@R0 MOV C,ACC.7 MOV 1FH,C MOV C,ACC.6 MOV ACC.7,C MOV R2,A INC R0 MOV A,@R0 MOV R3,A INC R0 MOV A,@R0 MOV R4,A DEC R0 DEC R0 LCALL MUL1 E20: MOV A,R3 ORL A,R4 JZ EXP1 MOV A,R2 JB ACC.7,EXP2 SETB C SUBB A,#6 JC EXP2 JB 1FH,EXP0 MOV @R0,#3FH INC R0 MOV @R0,#0FFH INC R0 MOV @R0,#0FFH DEC R0 DEC R0 SETB OV RET EXP0: MOV @R0,#41H CLR A INC R0 MOV @R0,A INC R0 MOV @R0,A DEC R0 DEC R0 CLR OV RET EXP1: MOV @R0,#1 INC R0 MOV @R0,#80H INC R0 MOV @R0,#0 DEC R0 DEC R0 CLR OV RET EXP2: MOV A,R2 MOV R5,A MOV A,R3 MOV R6,A MOV A,R4 MOV R7,A MOV C,1FH MOV 1EH,C ;对第一区取整 INT: MOV A,R3 ORL A,R4 JNZ INTA CLR 1FH MOV R2,#41H RET INTA: MOV A,R2 JZ INTB JB ACC.7,INTB CLR C SUBB A,#10H JC INTD RET INTB: CLR A MOV R4,A MOV C,1FH RRC A MOV R3,A RL A MOV R2,A JNZ INTC MOV R2,#41H INTC: RET INTD: CLR F0 MOV A,R3 JZ EXP4 EXP3: CLR C RRC A INC R2 CJNE R2,#8,EXP3 EXP4: MOV R3,A JNB 1FH,EXP5 CPL A INC A EXP5: PUSH ACC ;重新规格化 RLNORM: MOV A,R3 ORL A,R4 JNZ RLNORM1 MOV R2,#0C1H RET RLNORM1: MOV A,R3 JB ACC.7,RLNORM2 1 CLR C LCALL RL1 SJMP RLNORM RLNORM2: CLR OV RET RL1: MOV A,R4 RLC A MOV R4,A MOV A,R3 RLC A MOV R3,A DEC R2 CJNE R2,#0C0H,RL1E CLR A MOV R3,A MOV R4,A MOV R2,#0C1H RL1E: CLR OV RET