; Listing3-8.asm ; ; A program that demonstrates caling the math_twoTox, ; math_exp, math_10Tox, and math_yTox functions. 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-8", 0 three real8 3.0 .data align 16 aVal real8 0.0 aResult real8 0.0 .code ; Here is the main assembly language function. public asmMain asmMain proc push rbx sub rsp, 64 ;Shadow storage + alignment call print byte "(x)=(2**x, e**x, 10**x, 3**x)" byte nl, 0 ; Repeat for aVal = 0 to 20 by 1: mov rbx, 20 pgmLoop: ; Compute the assembly language 2**x result: math(twoTox) aVal fstp aResult mov rdx, aVal mov r8, aResult call print byte "(%4.1f)=(%9.2e,", 0 ; Compute the assembly language e**x result: math(exp) aVal fstp aResult mov rdx, aResult call print byte "%10.3e,", 0 ; Compute the assembly language 10**x result: math(tenTox) aVal fstp aResult mov rdx, aResult call print byte "%10.3e,", 0 ; Compute and display 3**x result; math(yTox) three, aVal fstp aResult mov rdx, aResult call print byte "%10.3e)", nl, 0 nextIteration: fld1 fld aVal faddp fstp aVal dec rbx jnz pgmLoop allDone: add rsp, 64 pop rbx ret ;Returns to caller asmMain endp end