//准备一个在汇编中要调用的函数
function DelphiFun(x,y: Integer): Integer;
begin
  Result := x + y;
end;


//汇编函数
function AsmFun: Integer;
asm
  mov eax, 1      {eax 对应函数的第一个参数, 这里给第一个参数赋值为 1}
  mov edx, 2      {edx 对应函数的第二个参数, 这里给第二个参数赋值为 2}
  call DelphiFun  {call 是调用命令; 返回值在 eax}
end;


//测试
procedure TForm1.Button1Click(Sender: TObject);
var
  num: Integer;
begin
  num := AsmFun;
  ShowMessage(IntToStr(num)); {3}
end;

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-25
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案