Lazarus Inline Assembler/ja: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: Lazarus Inline Assembler/ja
| Old | New | Line | |
|---|---|---|---|
| 1 | + | このページは、インラインアセンブラの組み込み方法を知ってもらうためのものです。以下に非常に簡単な例を示します。 | |
| 2 | + | ||
| 3 | + | ``` pascal | |
| 4 | + | unit unt_asm; | |
| 5 | + | {$mode objfpc}{$H+} | |
| 6 | + | interface | |
| 7 | + | uses | |
| 8 | + | Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls; | |
| 9 | + | type | |
| 10 | + | { TForm1 } | |
| 11 | + | TForm1 = class(TForm) | |
| 12 | + | btnGo: TButton; | |
| 13 | + | edtInput: TEdit; | |
| 14 | + | edtOutput: TEdit; | |
| 15 | + | Label1: TLabel; | |
| 16 | + | Label2: TLabel; | |
| 17 | + | procedure btnGoClick(Sender: TObject); | |
| 18 | + | private | |
| 19 | + | { private declarations } | |
| 20 | + | public | |
| 21 | + | { public declarations } | |
| 22 | + | end; | |
| 23 | + | var | |
| 24 | + | Form1: TForm1; | |
| 25 | + | implementation | |
| 26 | + | { TForm1 } | |
| 27 | + | ||
| 28 | + | procedure TForm1.btnGoClick(Sender: TObject); | |
| 29 | + | var | |
| 30 | + | num, answer : integer; | |
| 31 | + | begin | |
| 32 | + | num := StrToInt(edtInput.Text); | |
| 33 | + | //これは x86 上の Lazarus で必要なります。 | |
| 34 | + | {$ASMMODE intel} | |
| 35 | + | asm | |
| 36 | + | MOV EAX, num | |
| 37 | + | ADD EAX, 110B //2進数の 110 を足す | |
| 38 | + | SUB EAX, 2 //10進数の 2 を引く | |
| 39 | + | MOV answer, EAX | |
| 40 | + | end; | |
| 41 | + | edtOutput.Text := IntToStr(answer); | |
| 42 | + | end; | |
| 43 | + | ||
| 44 | + | initialization | |
| 45 | + | {$I unt_asm.lrs} | |
| 46 | + | end. | |
| 47 | + | ``` | |
| 48 | + | ||
| 49 | + | ## 関連項目 | |
| 50 | + | ||
| 51 | + | - [[VirtualTreeview Example for Lazarus]] | |
| 52 | + | ||
| 53 | + | --- | |
| 54 | + | *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](/wiki-contact).* | |
| 55 | + | Category: Tutorials/ja |
