【发布时间】:2019-11-04 13:42:48
【问题描述】:
这是一个说明我的问题的示例程序,它可以使用 FlatAssembler 编译而不使用链接器:
format PE console
entry start
include 'win32a.inc'
section '.text' code executable
start:
mov dword [esp],_output1
call [printf]
mov dword [esp+4],first
mov dword [esp],_input
call [scanf]
mov dword [esp],_output2
call [printf]
mov dword [esp+4],second
mov dword [esp],_input
call [scanf]
finit
fld dword [first]
fabs
fld dword [second]
fxch
fld1
fxch
fyl2x
fldl2e
fdivp st1,st0
fmulp st1,st0
fldl2e
fmulp st1,st0
fld1
fscale
fxch
fld1
fxch
fprem
f2xm1
faddp st1,st0
fmulp st1,st0
fstp dword [result]
fld dword [result]
fst qword [esp+4]
mov dword [esp],_output
call [printf]
invoke system,_pause
invoke exit,0
_output1 db "Enter the first number: ",0
_output2 db "Enter the second number: ",0
_input db "%f",0
_pause db "PAUSE",0
_output db "The first number to the power of the second number is: %f.",10,0
section '.rdata' readable writable
result dd ?
first dd ?
second dd ?
section '.idata' data readable import
library msvcrt,'msvcrt.dll'
import msvcrt,printf,'printf',system,'system',exit,'exit',scanf,'scanf'
所以,预期的输出当然是这样的:
Enter the first number: -2.5
Enter the second number: -2
The first number to the power of the second number is: 0.16
如果我在 Windows 10 上运行该程序,我确实得到了输出。但是,如果我尝试在 Oracle Linux 上的 WINE 上运行该程序,我得到的输出是:
000f:fixme:service:scmdatabase_autostart_services Auto-start service L"MountMgr" failed to start: 2
000f:fixme:service:scmdatabase_autostart_services Auto-start service L"WineBus" failed to start: 2
wine: Bad EXE format for Z:\home\teo.samarzija\Documents\Assembly\debug.exe.
知道发生了什么吗?
我做了一些研究,但我找不到任何参考资料来确认 _printf 和 _scanf 甚至在 WINE 的 MSVCRT 中实现。但是,我不确定这是不是问题,如果是问题,那就是唯一的问题。
【问题讨论】: