; Listing3-9.asm ; ; A program that demonstrates caling the math_ln, ; and math_log 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-9", 0 three real8 3.0 .data align 16 aVal real8 1.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)=(lg(x), ln(x), log(x))" byte nl, 0 ; Repeat for aVal = 1 to 1000 by powers of two: mov rbx, 10 pgmLoop: ; Compute the assembly language lg(x) ; (log base-2) result: fld1 fld aVal fyl2x fstp aResult mov rdx, aVal mov r8, aResult call print byte "(%6.1f)=(%10.3e,", 0 ; Compute the assembly language ln(x) result: math(ln) aVal fstp aResult mov rdx, aResult call print byte "%10.3e,", 0 ; Compute the assembly language 10**x result: math(log) aVal fstp aResult mov rdx, aResult call print byte "%10.3e)", nl, 0 nextIteration: fld aVal ;Double aVal fld aVal faddp fstp aVal dec rbx jnz pgmLoop allDone: add rsp, 64 pop rbx ret ;Returns to caller asmMain endp end