Delphi + Assembly Example 1 (Comparison of Say)

zhaozj2021-02-16  50

Simple, you can try it now :).

---- The test made when you have studied the previous studies. The first program just gives you an impression, there is still a post behind, talking in detail.

Unit unit1;

Interface

Useswindows, Messages, Sysutils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Stdctrls, ExtCtrls

typeTForm1 = class (TForm) Shape1: TShape; Label1: TLabel; Label2: TLabel; Label3: TLabel; Button1: TButton; Button2: TButton; Label4: TLabel; Label5: TLabel; Label6: TLabel; Button3: TButton; procedure Button1Click (Sender : TObject); procedure Button2Click (Sender: TObject); // procedure Button3Click (Sender: TObject); // procedure BtCalcuClick (sender: TObject); private {Private declarations} public {public declarations} end;

Varform1: TForm1; Function Sum1 (X, Y: Integer): Integer; Function Sum2 (x, y: integer): Integer; stdcall; function sum3 (var x, y: integer): integer; stdcall; import;

{$ R * .dfm}

Procedure TForm1.Button1Click (Sender: TOBJECT); VARI, J: Integer; beginlabel1.caption: = INTTOSTR (SUM1 (2, 3)); label2.caption: = INTOSTR (Sum2 (2, 3)); i: = 2 J: = 3; label3.caption: = INTTOSTR (Sum1 (i, j));

// Delphi program summation and function sum1 (x, y: integer): integer; beginResult: = x y;

// Computer and 1 --- function sum2 (x, y: integer): integer; stdcall; beginasmmow Eax, XADD EAX, YMOV @ Result, EAXEND; END; // Computer and 2 --- Function Sum3 (Var X, Y: Integer: Integer; Stdcall; Beginasmmow Eax, XMOV Eax, [EAX] MOV EDX, YADD EAX, [EDX] MOV @ Result, EAXEND;

Procedure TFORM1.BUTTON2CLICK (Sender: TOBJECT); beginclose;

{Procedure TFORM1.BUTTON3CLICK (Sender: TOBJECT); VARQUITFLAG: BOOLEAN; OUTBUFPTR: WORD; Beginasmmov Al, Quitflagmov BX, OutbuffPTrend; End;

End.

转载请注明原文地址:https://www.9cbs.com/read-25444.html

New Post(0)