Why when it goes to the cycle in ECX there some big random value insted of 0? And is there other way to make cycle here?
program Project2;
{$APPTYPE CONSOLE}
uses
SysUtils;
function FPUTest(a:Double):Double;
asm
FINIT
FLD a
MOV ecx,0
@cycle:
FADD st(0), st(0)
loop @cycle
end;
var a:Integer;
begin
readln(a);
Writeln(FPUTest(a));
end
.
ECXis a countdown register with respect to theloopinstruction. Starting with zero means it will loop through its full 32-bit range, beginning with0xffff ffff. Sometimes that is useful.In this case, if you want to loop 5 times, begin with
ecxset to 5.