Search code examples
debuggingassemblymasmx86-16code-view

LOOP instruction fails to loop even though (--cx != 0)


I'm implementing a multiplication algorithm for school, so please no help with the algorithm. I'm using C subroutine conventions, so I don't need to push CX, and the result is returned in DX:AX . I'm using codeview to do the debugging.

At the LOOP line, CX is seen to be 16:

enter image description here

After stepping with F10, I believe it should put me back at the shiftR label. What happens is that CX becomes 0, and I continue to exit the subroutine as is seen in this screenshot:

enter image description here

As well, you can see that the Carry and Overflow flags are set after stepping! I didn't think LOOP could do that? What gives? What am I overlooking?


Solution

  • SOLVED: I jumped the gun. As David Wohlferd mentioned, F8 is step and F10 is next using GDB terminology.