首页 文章

delphi asm代码win32 vs win64

提问于
浏览
-2

我在Delphi 10.1中的项目有一些这样的汇编函数:

function MyFunc: Word;
  asm
    PUSH   0
    FNSTCW [ESP].Word
    POP    EAX
  end;

我需要在win64中编译项目,但是像 POP EAX 这样的行有 E2116 Invalid combination of opcode and operands 错误 .

1 回答

  • 3

    而不是将程序集转换为x64,而应使用 System 单元中的Get8087CW()函数 . 它应该适用于两个平台(Win32 / Win64):

    function MyFunc: Word;
    begin
      Result := Get8087CW;
    end;
    

    为了将任何其他汇编代码(这里没有提供)从x86转换为x64,我建议你学习x64汇编编程 .

相关问题