From Learn @ Cemetech
Revision as of 17:24, 5 February 2016 by Maintenance script (talk | contribs) (Initial automated import)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Relative jumps to the address. This means that it can only jump between 128 bytes ahead or behind. Can be conditional or unconditional. JR takes up one less byte than JP, but is also slower. Weigh the needs of the code at the time before choosing one over the other (speed vs. size).


   JP NN			;unconditional jump
   JP cond.,NN		;conditional jump

Allowed Instructions

   JP NN		;no contition
   JR C,NN		;jumps if C is set
   JR NC,NN		;jumps if C is reset
   JR Z,NN		;jumps if Z is set
   JR NZ,NN	;jumps if Z is reset


All flags preserved.



cc is condition: NZ, Z, NC, C, PO, PE, P, M

X 12
condition met condition not met
cc,X 12 7

See Also