Overloaded Delphi 10.2 and Windows 10, but the errors are the same. Asm badly I just learn :)
one)
procedure u(a: cardinal);assembler; asm mov r15, [a] end; procedure TForm1.Button1Click(Sender: TObject); begin u(5); end; I put on the breakpoint on asm, turn on FreeMemoryContexts
unit Vcl.Controls; procedure TWinControl.MainWndProc(var Message: TMessage); begin try try WindowProc(Message); finally FreeDeviceContexts; FreeMemoryContexts; end; except Application.HandleException(Self); end; end; And Further Access violation at address. If we change the parameter in the procedure, what would be the 64-bit procedure u (a: Int64) the same error, so the matter is not in the dimension of the parameter and register.
2) We continue the experiment:
procedure u;assembler; asm mov rcx, 3 @N: nop loop @N nop end; procedure TForm1.Button1Click(Sender: TObject); begin u; end; In Delphi, the tick Optimization is not worth it, I put a breakpoint in the asm procedure, but it does not cycle three times, but passes 1 time, then resets the rcx and comes out easily, then at least without errors. It works, without a cycle, that with empty commands ( nop ), that with any other.