DJNZ Variable, Label

Function
Decrement value of Variable by one and jump to Label if Variable is not equal to zero.

Explanation
The DJNZ instruction decrements Variable by one and if the result of that operation is not zero the program will jump to the location specified by Label.

Start:
  flashes = 5

Main:
  HIGH RA.0
  PAUSE 100
  LOW RA.0
  PAUSE 400
  DJNZ flashes, Main                     ' flash until flashes = 0
  END

Related instruction: DEC