Lazarus Inline Assembler/ru
From Free Pascal wiki
Jump to navigationJump to searchThe printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
│
English (en) │
español (es) │
français (fr) │
日本語 (ja) │
한국어 (ko) │
русский (ru) │
Tiếng Việt (vi) │
Это не завершённая статья. Ниже приведён пример для начала работы:
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);
//для выполнения кода, требуется Lazarus x86:
{$ASMMODE intel}
asm
MOV EAX, num
ADD EAX, 110B //добавить двоичное число 110
SUB EAX, 2 //вычесть десятичное чило 2
MOV answer, EAX
end;
edtOutput.Text := IntToStr(answer);
end;
initialization
{$I unt_asm.lrs}
end.