JCXZ Jump If CX = 0
Flags affected:
O D I T S Z A P C OF: Overflow flag TF: Trap flag AF: Aux carry
F F F F F F F F F DF: Direction flag SF: Sign flag PF: Parity flag
<none> IF: Interrupt flag ZF: Zero flag CF: Carry flag
Legal forms:
JCXZ <short displacement>
Examples:
JCXZ AllDone ;Label AllDone must be within 127 bytes!
Notes:
Many instructions use CX as a count register, and JCXZ allows you to test and jump to see if CX has become 0. The jump may only be a short jump (that is, no more than 127 bytes forward or 128 bytes back) and will be taken if CX = 0 at the time the instruction is executed. If CX is any other value than 0, execution falls through to the next instruction. See also the Jump on Condition instructions.JCXZ is most often used to bypass the CX = 0 condition when using the LOOP instruction. Because LOOP decrements CX before testing for CX = 0, if you enter a loop governed by LOOP with CX = 0, you will end up iterating the loop 65,536 times, hence JCXZ.
r8 = AL AH BL BH CL CH DL DH r16 = AX BX CX DX BP SP SI DI
sr = CS DS SS ES FS GS r32 = EAX EBX ECX EDX EBP ESP ESI EDI
m8 = 8-bit memory data m16 = 16-bit memory data
m32 = 32-bit memory data i8 = 8-bit immediate data
i16 = 16-bit immediate data i32 = 32-bit immediate data
d8 = 8-bit signed displacement d16 = 16-bit signed displacement
d32 = 32-bit unsigned displacement