這是我的問題:
我試圖用scanf
(在msvcrt.dll
)輸入在flat assembler
一個浮點值,那麼我寫一個簡單的「scanf的節目」這樣的(在C
):x86彙編:MOVSD指令問題
#include <stdio.h>
int main() {
float a;
scanf("%f", &a);
printf("Just input: %f", a);
return 0;
}
然後使用cl.exe
與/FA
參數來編譯,以生成組件文件是這樣的:
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
我誤解的是movsd
指令。根據這裏:http://faydoc.tripod.com/cpu/movsb.htm它Move doubleword at address DS:(E)SI to address ES:(E)DI
但我沒有看到任何設置esi
, edi
在這裏和movsd
在生成的源文件有兩個參數,但在文件中的鏈接是它不應該。有人可以在這裏解釋我嗎?
謝謝!我知道了 :) –