0
調用printf向控制檯顯示狀態消息時,會輸出兩次。不知道爲什麼。我期望我的輸出是:從程序集調用printf時輸出字符串兩次
Generating move list file...
Done
而是我得到:
Generating move list file...
Done
Done
我得到一個重複的「完成」出於某種原因。
[SECTION .data]
GenMsg: db "Generating move list file...",10
DoneMsg: db "Done",10
extern printf
[SECTION .bss]
[SECTION .text]
global main
main:
push ebp ; set up stack frame
mov ebp,esp
push ebx ; save regs
push esi
push edi
push GenMsg ; push addr of gen msg on stack
call printf ; display gen msg
add esp,4 ; clean up stack 1 parm * 4 = 4 bytes
push DoneMsg ; push addr of done msg on stack
call printf ; display done msg
add esp,4 ; clean up stack 1 parm * 4 = 4 bytes
exit:
pop edi ; restore regs
pop esi
pop ebx
mov esp,ebp ; destroy stack frame
pop ebp
ret