The first argument to the function, n
, is stored in eax
, so your line
mov eax, n
is highly strange (move n
to n
). Also, if you change eax
, you change n
.
You could save the argument for future use (since you likely need to alter eax
):
var
tempN: integer;
asm
mov tempN, eax
Also, IIRC, you must not change the value of ebx
when writing inline ASM. Hence, you need to surround your code by push ebx
and pop ebx
.