经过大量的编辑,研究,我决定做正确的(我希望)。
所以,我想从命令行获取一个浮点数。
下面是代码。
format PE Console
entry start
include 'INCLUDE/win32ax.inc'
include 'INCLUDE/win_macros.inc'
section '.text' code readable executable
start:
finit
fld [a]
fld [b]
fmulp
fst [a]
cinvoke printf, '%.2f',dword [a],dword [a+4]
cinvoke printf,'%s','Begin number: '
cinvoke printf,'%s','a= '
cinvoke scanf, '%f',a
cinvoke printf, '%.2f',dword [a],dword [a+4]
cinvoke system, 'pause'
section '.data' code readable writeable executable
a dq 12.11
b dq 3.0
乘法是为了测试,并正确显示数字。
36.33
然后,我想扫描一个数字到 a 并将其打印出来,结果是
36.33
如何将这个数字移动到 a?
在@Peter Cordes的帮助下,我找到了解决方案。
start:
finit
cinvoke printf,'%s','Begin number: '
cinvoke printf,'%s','a= '
cinvoke scanf, '%lf', a ;here is the important thing
fld [a]
fld [b]
fmulp
fst [a]
cinvoke printf, '%.2f',double [a],double [a+4]
cinvoke system, 'pause'
section '.data' code readable writeable executable
a dq 0
b dq 3.0