我正在尝试在Windows Vista下运行masm32循环,但是我这样做了,即使它实际上完成了循环,它崩溃了,我看不出任何明智的理由......任何想法?
.386 .model flat, stdcall option casemap :none include \masm32\include\windows.inc include \masm32\include\kernel32.inc include \masm32\include\masm32.inc includelib \masm32\lib\kernel32.lib includelib \masm32\lib\masm32.lib .data ProgramText db "Looping!", 0 .data? loop_stopper dd ? .code start: mov loop_stopper,2 loop_start: invoke StdOut, addr ProgramText cmp loop_stopper, 0 dec loop_stopper jg loop_start end start
编辑
难道
invoke StdOut, offset ProgramText
仍然崩溃......
您需要有一个"退出"来结束您的申请.另外,我的个人风格是将所有内容都放在子程序中,但那只是我.
就像是:
.code
start:
call main inkey exit
main proc
mov loop_stopper,2 loop_start: invoke StdOut, addr ProgramText cmp loop_stopper, 0 dec loop_stopper jg loop_start ret
main endp
end start
.code
start:
call main
inkey
exit
main proc
mov loop_stopper,2
loop_start:
invoke StdOut, addr ProgramText
cmp loop_stopper, 0
dec loop_stopper
jg loop_start
ret
main endp
end start
.code
start:
call main inkey exit
main proc
mov loop_stopper,2 loop_start: invoke StdOut, addr ProgramText cmp loop_stopper, 0 dec loop_stopper jg loop_start ret
main endp
end start