; Listing3-6.asm ; ; A program that demonstrates caling the math_atan ; 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-6", 0 .data align 16 aVal real8 -2.0 one real8 1.0 zero real8 0.0 aResult real8 0.0 point5 real8 0.25 .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 = -4.0 to +4.0 by 0.5: mov rbx, 17 pgmLoop: ; Compute the assembly language result: math(atan) aVal fstp aResult mov rdx, aVal mov r8, aResult call print byte "ASM.atan(%4.1f)=%6.3f ", 0 ; Use C++ atan: movsd xmm0, aVal call atan ; Print the C result: movsd aResult, xmm0 mov rdx, aVal mov r8, aResult call print byte "C.atan(%4.1f)=%6.3f", nl, 0 fld point5 fld aVal faddp fstp aVal dec rbx jnz pgmLoop allDone: add rsp, 64 pop rbx ret ;Returns to caller asmMain endp end