I am currently learning x86 assembly language using NASM from the following website: https://www.asmtutor.com/ and I am presently on Lesson 11 if you require the full code of this example.
Using the divideLoop: subroutine below how does the cmp instruction not set the zero flag (ZF) after just the first iteration? Doesn't idiv set eax to the quotient part and edx to the remainder?
;EAX is set as 1 before the first iteration.
divideLoop:
inc ecx
mov edx, 0
mov esi, 10
idiv esi
add edx, 48
push edx
cmp eax, 0
jnz divideLoop
I was under the impression that after idiv esi that eax would be set to 0 and edx would be set to 1 since 1 / 10 = 0R1 and therefore cmp eax, 0 would equal zero and thus set the zero flag.
Maybe I'm misunderstanding how idiv works with the quotient part or how cmp sets the zero flag?