This is my problem:
I trying to use scanf
(in msvcrt.dll
) to input a single floating point value in flat assembler
then I write a simple "scanf program" like this (in C
):
#include <stdio.h>
int main() {
float a;
scanf("%f", &a);
printf("Just input: %f", a);
return 0;
}
then using cl.exe
to compile with /FA
parameter to generate assembly file like this:
lea eax, DWORD PTR _a$[ebp]
push eax
push OFFSET $SG2935
call _scanf
add esp, 8
; Line 8
cvtss2sd xmm0, DWORD PTR _a$[ebp]
sub esp, 8
movsd QWORD PTR [esp], xmm0
push OFFSET $SG2936
call _printf
add esp, 12 ; 0000000cH
What I missunderstand is movsd
instruction. According here: http://faydoc.tripod.com/cpu/movsb.htm it Move doubleword at address DS:(E)SI to address ES:(E)DI
but I don't see any setting esi
, edi
up here and the movsd
in generated source file have two parameters but in document in the link is it should not. Can someone explain me here?