Assembly – JZ instruction after CMP

assembly

I have the next instruction:

cmp al, 1
jz mub

When al is 2 (10 in binary). What would do this instruction? As I know, I can use JE,JNE,JA etc., but what is meaning jz after cmp instruction?

Thanks

Best Answer

jz is "jump if zero". cmp subtracts its two operands, and sets flags accordingly. (See here for reference.)

If the two operands are equal, the subtraction will result in zero and the ZF flag will be set.

So in your sample, the jump will be taken if al was 1, not taken otherwise.