QQ:184324486 超级大师
;------------------------------------------------------------------------------- LDY_ARCSINCOS: PUSH ACC PUSH PSW MOV A,R0 PUSH ACC MOV A,R1 PUSH ACC MOV A,R2 PUSH ACC
PUSH CAL_TEMP4 PUSH CAL_TEMP5 PUSH CAL_TEMP6 PUSH CAL_TEMP7 PUSH CAL_TEMP8 PUSH CAL_TEMP9 PUSH CAL_TEMPA PUSH CAL_TEMPB PUSH CAL_TEMPC PUSH CAL_TEMPD PUSH CAL_TEMPE PUSH CAL_TEMPF PUSH CAL_TEMPG PUSH CAL_TEMPH PUSH CAL_TEMPI PUSH CAL_TEMPJ
MOV R2,#000H ;Y1=Y*2^R2 CLR FLAG_TEMP3 MOV A,CAL_TEMP2 JNB ACC.7,ARCSINCOS_INIT SETB FLAG_TEMP3 LCALL BYTE3_NEGATIVE ;ABS(X) ARCSINCOS_INIT: MOV CAL_TEMP8,CAL_TEMP0 MOV CAL_TEMP9,CAL_TEMP1 MOV CAL_TEMPA,CAL_TEMP2 MOV CAL_TEMPB,CAL_TEMP3
MOV CAL_TEMP7,#0EAH ;CAL_TEMP(7_4)=1 MOV CAL_TEMP6,#01000000B MOV CAL_TEMP5,#00000000B MOV CAL_TEMP4,#00000000B LCALL FLOAT_SUB MOV A,CAL_TEMP2 JB ACC.7,EXIT_ARCSINCOS_INIT
;X>=1 ,Y=PAI/2, CAL_TEMP3_0=PAI/2 MOV CAL_TEMP3,#0EAH MOV CAL_TEMP2,#01100100B MOV CAL_TEMP1,#10000111B MOV CAL_TEMP0,#11101101B LJMP EXIT_ARCSINCOS_MUL EXIT_ARCSINCOS_INIT: MOV CAL_TEMP0,CAL_TEMP8 MOV CAL_TEMP1,CAL_TEMP9 MOV CAL_TEMP2,CAL_TEMPA MOV CAL_TEMP3,CAL_TEMPB LOOP_ARCSINCOS_HALFANGLE: ;SIN(Y/2)=SQR((1-SQR(1-SIN(Y)*SIN(Y)))/2) MOV CAL_TEMPG,CAL_TEMP0 MOV CAL_TEMPH,CAL_TEMP1 MOV CAL_TEMPI,CAL_TEMP2 MOV CAL_TEMPJ,CAL_TEMP3 ;CAL_TEMP(7_4)=0.1 MOV CAL_TEMP7,#0E6H MOV CAL_TEMP6,#01100110B MOV CAL_TEMP5,#01100110B MOV CAL_TEMP4,#01100110B LCALL FLOAT_SUB MOV A,CAL_TEMP2 JNB ACC.7,ARCSINCOS_GETHALFANGLE LJMP ARCSINCOS_MUL_INIT ;0<=X<0.1 ? ARCSINCOS_GETHALFANGLE: INC R2 MOV CAL_TEMP0,CAL_TEMPG MOV CAL_TEMP1,CAL_TEMPH MOV CAL_TEMP2,CAL_TEMPI MOV CAL_TEMP3,CAL_TEMPJ LCALL FLOATTODOUBLE
MOV CAL_TEMP8,CAL_TEMP0 MOV CAL_TEMP9,CAL_TEMP1 MOV CAL_TEMPA,CAL_TEMP2 MOV CAL_TEMPB,CAL_TEMP3 MOV CAL_TEMPC,CAL_TEMP4 MOV CAL_TEMPD,CAL_TEMP5 MOV CAL_TEMPE,CAL_TEMP6 MOV CAL_TEMPF,CAL_TEMP7 LCALL DOUBLE_MUL LCALL BYTE8_SWAP
;CAL_TEMP(7_0)=1 MOV CAL_TEMP7,#0FFH MOV CAL_TEMP6,#0D2H MOV CAL_TEMP5,#01000000B MOV CAL_TEMP4,#000H MOV CAL_TEMP3,#000H MOV CAL_TEMP2,#000H MOV CAL_TEMP1,#000H MOV CAL_TEMP0,#000H LCALL DOUBLE_SUB LCALL DOUBLE_SQUAREROOT LCALL BYTE8_SWAP
;CAL_TEMP(7_0)=1 MOV CAL_TEMP7,#0FFH MOV CAL_TEMP6,#0D2H MOV CAL_TEMP5,#01000000B MOV CAL_TEMP4,#000H MOV CAL_TEMP3,#000H MOV CAL_TEMP2,#000H MOV CAL_TEMP1,#000H MOV CAL_TEMP0,#000H LCALL DOUBLE_SUB
CLR C MOV A,CAL_TEMP6 SUBB A,#001H MOV CAL_TEMP6,A MOV A,CAL_TEMP7 SUBB A,#000H MOV CAL_TEMP7,A
LCALL DOUBLE_SQUAREROOT LCALL DOUBLETOFLOAT LJMP LOOP_ARCSINCOS_HALFANGLE
ARCSINCOS_MUL_INIT: ;CAL_TEMP(C-F)=ITEM ;CAL_TEMP(G-J)=SUM ;CAL_TEMP(B-8)=X*X MOV CAL_TEMP0,CAL_TEMPG MOV CAL_TEMP4,CAL_TEMPG MOV CAL_TEMP8,CAL_TEMPG MOV CAL_TEMPC,CAL_TEMPG
MOV CAL_TEMP1,CAL_TEMPH MOV CAL_TEMP5,CAL_TEMPH MOV CAL_TEMP9,CAL_TEMPH MOV CAL_TEMPD,CAL_TEMPH
MOV CAL_TEMP2,CAL_TEMPI MOV CAL_TEMP6,CAL_TEMPI MOV CAL_TEMPA,CAL_TEMPI MOV CAL_TEMPE,CAL_TEMPI
MOV CAL_TEMP3,CAL_TEMPJ MOV CAL_TEMP7,CAL_TEMPJ MOV CAL_TEMPB,CAL_TEMPJ MOV CAL_TEMPF,CAL_TEMPJ
CALL FLOAT_MUL MOV CAL_TEMP8,CAL_TEMP0 MOV CAL_TEMP9,CAL_TEMP1 MOV CAL_TEMPA,CAL_TEMP2 MOV CAL_TEMPB,CAL_TEMP3
;5 ITEMS END ITEM=3^2*5^2*7^2/9!*X^9 MOV R1,#004H MOV R0,#001H LOOP_ARCSINCOS_MUL: MOV A,R0 MOV B,R0 MUL AB MOV CAL_TEMP4,A MOV CAL_TEMP5,#000H MOV CAL_TEMP6,#000H MOV CAL_TEMP7,#000H
MOV CAL_TEMP0,CAL_TEMPC MOV CAL_TEMP1,CAL_TEMPD MOV CAL_TEMP2,CAL_TEMPE MOV CAL_TEMP3,CAL_TEMPF
LCALL FLOAT_MUL LCALL BYTE4_SWAP
INC R0 MOV A,R0 INC R0 MOV B,R0 MUL AB MOV CAL_TEMP0,A MOV CAL_TEMP1,#000H MOV CAL_TEMP2,#000H MOV CAL_TEMP3,#000H LCALL BYTE4_SWAP LCALL FLOAT_DIV
MOV CAL_TEMP4,CAL_TEMP8 MOV CAL_TEMP5,CAL_TEMP9 MOV CAL_TEMP6,CAL_TEMPA MOV CAL_TEMP7,CAL_TEMPB LCALL FLOAT_MUL
MOV CAL_TEMPC,CAL_TEMP0 MOV CAL_TEMPD,CAL_TEMP1 MOV CAL_TEMPE,CAL_TEMP2 MOV CAL_TEMPF,CAL_TEMP3
MOV CAL_TEMP4,CAL_TEMPG MOV CAL_TEMP5,CAL_TEMPH MOV CAL_TEMP6,CAL_TEMPI MOV CAL_TEMP7,CAL_TEMPJ LCALL FLOAT_ADD MOV CAL_TEMPG,CAL_TEMP0 MOV CAL_TEMPH,CAL_TEMP1 MOV CAL_TEMPI,CAL_TEMP2 MOV CAL_TEMPJ,CAL_TEMP3 DJNZ R1,LOOP_ARCSINCOS_MUL EXIT_ARCSINCOS_MUL: MOV A,R2 ADD A,CAL_TEMP3 MOV CAL_TEMP3,A JNB FLAG_TEMP3,ARCSINCOS_GETSINCOS LCALL BYTE3_NEGATIVE ARCSINCOS_GETSINCOS: JNB FLAG_TEMP4,EXIT_LDY_ARCSINCOS ;ARCCOS(X)=PAI/2-ARCSIN(X) ;CAL_TEMP3_0=PAI/2 LCALL BYTE4_SWAP MOV CAL_TEMP3,#0EAH MOV CAL_TEMP2,#01100100B MOV CAL_TEMP1,#10000111B MOV CAL_TEMP0,#11101101B LCALL FLOAT_SUB
EXIT_LDY_ARCSINCOS: POP CAL_TEMPJ POP CAL_TEMPI POP CAL_TEMPH POP CAL_TEMPG POP CAL_TEMPF POP CAL_TEMPE POP CAL_TEMPD POP CAL_TEMPC POP CAL_TEMPB POP CAL_TEMPA POP CAL_TEMP9 POP CAL_TEMP8 POP CAL_TEMP7 POP CAL_TEMP6 POP CAL_TEMP5 POP CAL_TEMP4 POP ACC MOV R2,A POP ACC MOV R1,A POP ACC MOV R0,A POP PSW POP ACC RET ;------------------------------------------------------------------------------- ;FUNCTION: CAL ARCSIN(X) X=CAL_TEMP(3_0)=[-1,1],X=BINARY FLOAT LDY_ARCSIN: PUSH CAL_STATE1 CLR FLAG_TEMP4 LCALL LDY_ARCSINCOS POP CAL_STATE1 RET ;------------------------------------------------------------------------------- ;FUNCTION: CAL ARCCOS(X) X=CAL_TEMP(3_0)=[-1,1] LDY_ARCCOS: PUSH CAL_STATE1 SETB TEMPFLAG4 LCALL LDY_ARCSINCOS POP CAL_STATE1
RET |