Relative Branches

The PIC18 devices implement conditional relative branch instructions, e.g., bz, bnz. These instructions have a limited jump range compared to the goto instruction.

Note that in some instance, the assembler can change a relative branch instruction to be a relative branch with the opposite condition over a goto instruction. For example:

  bz error
  ;next

can become:

  bnz l18
  goto error
l18:
  ;next

This transformation is made so that a conditional branch can be made to span the same range as a goto instruction.

This substitution will not take place for assembly placed in-line with C code, or for assembly source that is protected with the ASMOPT directive (see Asmopt Directive).