NASM Forum > Programming with NASM

Code loops infinitely

<< < (2/2)

fredericopissarra:

--- Quote from: nohemon on September 17, 2020, 04:02:27 PM ---So, the conditional jump instructions use the value that is in the offset RIGHT BEFORE them? even if there is no CMP instruction?
--- End quote ---

No... conditional jumps uses the FLAGS to decide if the jump is taken or not... DEC affects the FLAGS.

debs3759:

--- Quote from: nohemon on September 17, 2020, 04:02:27 PM ---So, the conditional jump instructions use the value that is in the offset RIGHT BEFORE them? even if there is no CMP instruction?

--- End quote ---

The conditional jump uses whatever is the last condition generated (ie the flags, as fred said). In this case it uses the result of the preceding dec. Your code would work with the new push/pop, it's just slightly less optimal.

nohemon:
Ok now I get it. Thank you both.

Navigation

[0] Message Index

[*] Previous page

Go to full version