CPU provides a lot of registers, but in the process and function of Delphi, only EAX ECX EDX three registers are free to use;
If you change the other registers, restore them before the procedure and function are finished.
Remember the previous learning Delphi process and function The default calling convention is register, the first three parameters are passed through registers, and other parameters are stored and stack.
The three registers it refers to should be EAX ECX EDX.
Read the information should be: EAX accept the first parameter and then accept the return value, ECX EDX accept the following two parameters.
But I can't do the full test.//测试三个自由寄存器: EAX ECX EDX
procedure Proc(x,y,z: Integer);
var
a,b: Integer;
begin
asm
MOV a,ECX
MOV b,EDX
end;
ShowMessage(Format('%d,%d',[a,b]));
{EAX 我测试不了}
end;
//测试
procedure TForm1.Button1Click(Sender: TObject);
begin
Proc(11,22,33); {显示: 33,22}
{看来寄存器 ECX 储存的是第三个参数; EDX 储存第二个参数}
end;