Z80:Opcodes:DJNZ: Difference between revisions

From Learn @ Cemetech
Jump to navigationJump to search
Initial automated import
 
mNo edit summary
 
Line 16: Line 16:


<!-- What the instruction can be used for -->
<!-- What the instruction can be used for -->
DJNZ is a very useful instruction when it comes to creating loops. See [[Z80:Control-structures|Control Structures]] to find out more about loops.
DJNZ is a very useful instruction when it comes to creating loops. See [[Z80:Control Structures|Control Structures]] to find out more about loops.


== T-States ==
== T-States ==

Latest revision as of 08:00, 6 February 2016

Decreases B and jumps to a label if not zero. Note that DJNZ does a relative jump, so it can only jump between 128 bytes back/ahead.

Syntax

   djnz label

Effects

Preserves all flags.

Uses

DJNZ is a very useful instruction when it comes to creating loops. See Control Structures to find out more about loops.

T-States

B != 0 13
B == 0 8

See Also

CALL,JP,JR