FPU. How to make a loop?

Why, when it goes into a cycle in ECX, does there exist some large random value equal to 0? And is there another way to make a loop 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 

.

+4
source share
1 answer

ECX is a countdown register relative to the loop command. Starting from scratch means that it will fulfill the full 32-bit range, starting with 0xffff ffff . This is sometimes useful.

In this case, if you want to run the loop 5 times, start with ECX set to 5.

+6
source

Source: https://habr.com/ru/post/1445567/


All Articles