2
votes

I'm currently working on an Assembly program that makes uses of both the CPU and FPU registers. My question concerns how it is possible to load a register value to the FPU stack (namely ecx).

mov    ecx, 10d    ; Load 10 into ECX
fldpi              ; Load Pi
fild   ecx         ; This does not work, it does however for .data variables
fmul               ; Multiply

Any help would be greatly appreciated. I'm developing using Visual Studio 2015/MASM, with .386 and .model flat, STDCALL.

Best regards, Z

1
You can only load from memory, the manual says so, so really you could have known..harold
Unfortunately I did not.Zimon

1 Answers

5
votes

You could do:

mov [temp_mem],ecx
fild dword ptr [temp_mem]

or

push ecx
fild dword ptr [esp]
pop ecx

or you could just have the constant 10 in your data section:

.data
ten dd 10
.code
fild dword ptr [ten]