I’m trying to make a loop in masm32 running under Windows Vista, however I did it this way and even though it actually finishes the loop, it crashes and I see no obvious reason why…any ideas?
.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
Edit
Did
invoke StdOut, offset ProgramText
still crashes…
You need to have an ‘exit’ to end your application. Also, my personal style is to put everything inside a subroutine, but that’s just me.
something like:
.codestart:
main proc
main endp
end start