; Listing3-2.asm ; ; A program that demonstrates caling the math_acot ; function. option casemap:none ; Include the aoalib (ANSI strings) and aoamath ; libraries: include aoalib.inc include math.inc includelib aoalib.lib includelib aoamath.lib .const ; Program title: align word ttlStr byte "Listing 3-2", 0 .data align 16 aVal real8 -1.0 one real8 1.0 aResult real8 0.0 point1 real8 0.1 .code ; External definitions for C/C++ atan function externdef atan:proc ; Here is the main assembly language function. public asmMain asmMain proc push rbx sub rsp, 64 ;Shadow storage + alignment ; Repeat for aVal = -1.0 to +1.0 by 0.1: mov rbx, 21 pgmLoop: ; Compute the assembly language result: math(acot) aVal fstp aResult mov rdx, aVal mov r8, aResult call print byte "ASM.acot(%4.1f)=%6.3f ", 0 ; There is no ACOT function in C/C++, must compute ; it as acot(x) = atan(1/x) movsd xmm1, one movsd xmm0, aVal divsd xmm0, xmm1 call atan movsd aResult, xmm0 mov rdx, aVal mov r8, aResult call print byte "C.acot(%4.1f)=%6.3f", nl, 0 fld point1 fld aVal faddp fstp aVal dec rbx jnz pgmLoop allDone: add rsp, 64 pop rbx ret ;Returns to caller asmMain endp end