Sign in Join
Wiki copytemporary

Lazarus inline assembler: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

Title: Lazarus Inline Assembler Lazarus inline assembler

OldNewLine
1-This is a stub to encourage others to contribute further. Here is a very simple example to get you started:
1+This is a stub to encourage others to contribute further. Here is a very simple example to get started:
22
33``` pascal
44unit unt_asm;
55{$mode objfpc}{$H+}
66interface
77uses
88 Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls;
99type
1010 { TForm1 }
1111 TForm1 = class(TForm)
1212 btnGo: TButton;
1313 edtInput: TEdit;
1414 edtOutput: TEdit;
1515 Label1: TLabel;
1616 Label2: TLabel;
1717 procedure btnGoClick(Sender: TObject);
1818 private
1919 { private declarations }
2020 public
2121 { public declarations }
2222 end;
2323var
2424 Form1: TForm1;
2525implementation
2626{ TForm1 }
2727
2828procedure TForm1.btnGoClick(Sender: TObject);
2929var
3030 num, answer : integer;
3131begin
3232 num := StrToInt(edtInput.Text);
3333 //This is required with Lazarus on x86:
3434 {$ASMMODE intel}
3535 asm
3636 MOV EAX, num
3737 ADD EAX, 110B //add binary 110
3838 SUB EAX, 2 //subtract decimal 2
3939 MOV answer, EAX
4040 end;
4141 edtOutput.Text := IntToStr(answer);
4242end;
4343
4444initialization
4545 {$I unt_asm.lrs}
4646end.
4747```
4848
49-## See also
50-
51-- [[VirtualTreeview Example for Lazarus]]
52-
5349---
54-*From the Free Pascal wiki, page "Lazarus Inline Assembler", 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](/wiki-contact).*
55-Category: Tutorials
50+*From the Free Pascal wiki, page "Lazarus inline assembler", as it stood on 2020-02-18 after a change by Trev, 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](/wiki-contact).*
51+Category: Proposals

Back to history