【发布时间】:2014-11-06 21:32:44
【问题描述】:
当调用 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
【问题讨论】: