Using 'loop' causes infinite loop
I'm just trying to simplest loop for assembly, and for the first four loops, it seems to work fine. But after the first four loops, it goes into an infinite loop.
.data
loop_count1 DWORD 4
.code
main PROC
mov ecx, loo开发者_StackOverflowp_count1
loop11:
loop loop11
call dumpmem
call crlf
exit
main ENDP
END main
Anyone know why?
EDIT: sorry, the loop wasn't the problem after all. calling dumpmem seems to be the problem, but I've used the same thing in other programs before, so I'm still not sure what I'm doing wrong.
It's a very old time when I saw assembler, so I can't give you professional answer :) I think that ecx after the loop becomes equal to 0. And it's quite possible that dumpmem can not accpet register ecx to be zero. Just for testing purposes you can add a line mov ecx, 1
just before the call of dumpmem. Still infinite loop?
精彩评论