Lazarus Inline Assembler/ja
한국어 · English · Español · Français · Tiếng Việt · Русский · 日本語
このページは、インラインアセンブラの組み込み方法を知ってもらうためのものです。以下に非常に簡単な例を示します。
unit unt_asm;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls;
type
{ TForm1 }
TForm1 = class(TForm)
btnGo: TButton;
edtInput: TEdit;
edtOutput: TEdit;
Label1: TLabel;
Label2: TLabel;
procedure btnGoClick(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
{ TForm1 }
procedure TForm1.btnGoClick(Sender: TObject);
var
num, answer : integer;
begin
num := StrToInt(edtInput.Text);
//これは x86 上の Lazarus で必要なります。
{$ASMMODE intel}
asm//2進数の 110 を足す//10進数の 2 を引く
MOV EAX, num
ADD EAX, 110B //2進数の 110 を足す
SUB EAX, 2 //10進数の 2 を引く
MOV answer, EAX
END;
edtOutput.Text := IntToStr(answer);
end;
initialization
{$I unt_asm.lrs}
end.関連項目
From the Free Pascal wiki, page "Lazarus Inline Assembler/ja", as it stood on 2020-01-09 after a change by Bart, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.