En + fonctionel, et en delphi dans le texte, ca donne :
unit pcalcasm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
private
{ Déclarations privées }
public
{ Déclarations publiques }
end;
var
Form1: TForm1;
Type TMyType=array[0..100] of byte;
implementation
{$R *.dfm}
Function Calcul(a,b:TMyType;size:Integer):TMyType;assembler;
asm
Push esi
Push ebx
mov esi,result
@NextByte:
mov bl,Byte[eax+ecx]
add bl,Byte[edx+ecx]
mov byte ptr([esi+ecx]),bl
loop @NextByte
pop edx
pop esi
end;
procedure TForm1.Button1Click(Sender: TObject);
var j : Integer;
a,b,c : TmyType;
begin
for j:=0 to 100 do
begin
a[j]:=j;
b[j]:=j+10;
end;
c:=Calcul(a,b,sizeof(TmyType));
for j:=0 to 100 do
Memo1.Lines.Add(Inttostr(a[j])+'+'+Inttostr(b[j])+'='+Inttostr(c[j]));
end;
end.
Bon Coding ....
ManChesTer.