JZ, JNZ

Directives. Jump if the result of logical operation is zero (JZ), or is not zero (JNZ).

Syntax

jz <label>     ; Jump if result is zero
jnz <label>    ; Jump if result is not zero
random jz <label> <label> ... <label>   ; Jump to any label if result is zero
random jnz <label> <label> ... <label>  ; Jump to any label if result is not zero

Parameters

label
  • Label can be defined by three ways:
  • label <labelname>
  • <labelname>:
  • :<labelname>
  • Other commands can not be placed in same line with label definition.

Example file jzjnz.txt

10          ; Set initial state

CYCLE:      ; Define the label CYCLE

test i 1    ; Test input bit 379h:6 (Pin 10)
jz ABC      ; Jump if tested bit is zero
jnz DEF     ; Jump if tested bit is not zero

nop

ABC:
shift -1    ; Rotate state unclockwise
goto CYCLE  ; Goto the CYCLE label

DEF:
shift +1    ; Rotate state clockwise
goto CYCLE  ; Goto the CYCLE label