I've seen many programs which use the inefficient code: or cx,cx
jz label
when they should use jcxz label
However, not so obvious is when the code is: or cx,cx
jnz label
You can still reduce this by one byte with a 3-byte alias for jcxnz label
by using: inc cx
loop label
If CX
began as zero, the INC
sets it to 0001
. That is also the only situation where the LOOP
command would permit the code to fall through to the next command instead of looping to the label.
This alias for JCXNZ
does affect some flags, so might not be usable in all situations.