unit kasm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 =
class(TForm)
Button1: TButton;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Button2: TButton;
Label1: TLabel;
Label3: TLabel;
Label4: TLabel;
Label7: TLabel;
Label8: TLabel;
Button3: TButton;
Button4: TButton;
Label9: TLabel;
Label10: TLabel;
Label2: TLabel;
Label5: TLabel;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
result1,wert1,wert2,c: Integer;
start1,end1:tdatetime;
result2:PChar;
result3:
string;
implementation
{$R *.dfm}
///////////////////////////////////////////////////////////////////////////////////////////////////
//Globale Optionen
procedure TForm1.FormCreate(Sender: TObject);
begin
c:=1000000000;
label2.Caption:=inttostr(c);
label5.Caption:=inttostr(c);
end;
///////////////////////////////////////////////////////////////////////////////////////////////////
//Addition
procedure TForm1.Button1Click(Sender: TObject);
begin
button1.Enabled:=false;
button2.Enabled:=false;
wert1:=strtoint(edit1.text);
wert2:=strtoint(edit2.text);
start1:=now;
asm
MOV ECX,c
@schleife1:
MOV EAX,wert1
ADD EAX,wert2
LOOP @schleife1
MOV result1,EAX
end;
end1:=now;
label3.Caption:=inttostr(result1)+'
'+Formatdatetime('
ss:zzz',end1-start1);
button1.Enabled:=true;
button2.Enabled:=true;
end;
procedure TForm1.Button2Click(Sender: TObject);
var i:integer;
begin
button1.Enabled:=false;
button2.Enabled:=false;
wert1:=strtoint(edit1.text);
wert2:=strtoint(edit2.text);
result1:=0;
start1:=now;
for i:=1
to c
do result1:=wert1+wert2;
end1:=now;
label4.Caption:=inttostr(result1)+'
'+Formatdatetime('
ss:zzz',end1-start1);
button1.Enabled:=true;
button2.Enabled:=true;
end;
///////////////////////////////////////////////////////////////////////////////////////////////////
//Vergleich
procedure TForm1.Button3Click(Sender: TObject);
//var i:integer;
begin
button3.Enabled:=false;
button4.Enabled:=false;
wert1:=strtoint(edit3.text);
wert2:=strtoint(edit4.text);
start1:=now;
asm
MOV ECX,c
@LO1:
JMP @START
@SIM:
DB '
gleich',0
RET
@OPP:
DB '
ungleich',0
RET
@START: MOV EBX,wert1
MOV EDX,wert2
CMP EBX,EDX
JE @CALL
LEA EDI, @OPP
@CALL: LEA EDI, @SIM
LOOP @LO1
MOV result2,EDI
end;
end1:=now;
label7.Caption:=result2+'
'+Formatdatetime('
ss:zzz',end1-start1);
button3.Enabled:=true;
button4.Enabled:=true;
end;
procedure TForm1.Button4Click(Sender: TObject);
var i:integer;
begin
button3.Enabled:=false;
button4.Enabled:=false;
wert1:=strtoint(edit3.text);
wert2:=strtoint(edit4.text);
start1:=now;
for i:=1
to c
do If wert1=wert2
then result2:='
gleich'
else result2:='
ungleich';
end1:=now;
label8.Caption:=result2+'
'+Formatdatetime('
ss:zzz',end1-start1);
button3.Enabled:=true;
button4.Enabled:=true;
end;
///////////////////////////////////////////////////////////////////////////////////////////////////
end.