unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, Grids;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Edit1: TEdit;
    Edit2: TEdit;
    Edit3: TEdit;
    Button2: TButton;
    Button3: TButton;
    Edit4: TEdit;
    Button4: TButton;
    Edit5: TEdit;
    StringGrid1: TStringGrid;
    Button5: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;


implementation
{$L pascal.obj}
{$L array.obj}
{$L string.obj}
{$R *.DFM}
Type arr=array[1..5] of byte;
Var a:arr;
procedure ADD1 (A,B:integer; Var D:integer);pascal;external;
function Dell1(S:ShortString):ShortString;pascal;external;
procedure Array_add;pascal;external;
function Dell(S:ShortString):ShortString;pascal;
begin
 Result:=S;
end;
procedure Print(n:byte);pascal;
begin
   Form1.Edit3.text:=inttostr(n);
end;
Function add(A,B:integer):integer;pascal;
Begin
   Result:=A+B;
End;
procedure TForm1.Button1Click(Sender: TObject);
Var A,B,C:integer;
begin
     A:=strtoint(Edit1.text);
     B:=strtoint(Edit2.Text);
     ADD1(A,B,C);
     Edit3.Text:=inttostr(C);
end;

procedure TForm1.Button2Click(Sender: TObject);
Var A,B,C:integer;
begin
     A:=strtoint(Edit1.text);
     B:=strtoint(Edit2.Text);
     Asm
      mov eax,A
      sub eax,B
      mov C,eax
     end;
     Edit3.Text:=inttostr(C);
end;

procedure TForm1.Button3Click(Sender: TObject);
Var i:LongInt; S:LongInt;
begin
        S:=0;
        For i:=1 to 10000 do
        S:=S+i;
        Edit3.Text:=inttostr(S);
end;

procedure TForm1.Button4Click(Sender: TObject);
Var S:ShortString;
begin
     S:=Edit4.Text;
     Edit5.Text:=Dell1(S);
end;

procedure TForm1.Button5Click(Sender: TObject);
Var  i:byte;
begin
    for i:=1 to 5 do a[i]:=strtoint(stringGrid1.Cells[i-1,1]);
    array_add;
    for i:=1 to 5 do stringGrid1.Cells[i-1,1]:=inttostr(a[i]);
end;

end.
