There are two kinds of jump instructions. Absolute and relative.
JP cc,address
Jump to address if condition code cc is true. Otherwise advance the program counter to the next instruction.
Address is a direct 16 bits address. You can jump to any address from 0 - 64k
JR cc,relative_address
Add relative address to programcounter if condition code cc is true. Otherwise advance the program counter to the next instruction.>
Address is a relative 8 bits address. You can only jump between -128 or +127.
Note: You can use JR with labels like this: JR my_label since the assembler will take care of calculating the relative address.
If you always want to jump no matter what you don't have to specify a condition code, but if you only want to jump when a certain set of contitions are met you need to add one of these codes.
Note: You can only have one condition code per jump instruction.
Hex | Mnemonic | Definition | Flag Test Operation |
0 | F | Always False | - |
1 | LT | Less Than | (S XOR V)=1 |
2 | LE | Less Than or Equal | (Z OR (S XOR V)) = 1 |
3 | ULE | Unsigned Less Than or Equal | (C OR Z) = 1 |
4 | OV | Overflow | V=1 |
5 | MI | Minus | S=1 |
6 | Z | Zero | Z=1 |
6 | EQ | Equal | Z=1 |
7 | C | Carry | C=1 |
7 | ULT | Unsigned Less Than | C=1 |
8 | T(or blank) | Always True(default) | - |
9 | GE | Greater Than or Equal | (S XOR V) = 0 |
A | GT | Greater Than | (Z OR (S XOR V)) = 0 |
B | UGT | Unsigned Greater Than | (C = 0 AND Z = 0) = 1 |
C | NOV | No Overflow | V=0 |
D | PL | Plus | S=0 |
E | NZ | Non-Zero | Z=0 |
E | NE | Not-Equal | Z=0 |
F | NC | No-Carry | C=0 |
F | UGE | Unsigned Greater Than or Equal | C=0 |
main: ;This code will loop infinitely. jp mainJump relative to a label
main: ;This code does the same as the previous code: loop indefinitely. jr mainJump relative to anonymous label
$$: jr $F ;Jump Forward to next $$ label (anonymous label) jr $B ;Jump Back to previous $$ label (anonymous label) $$:Jump to local label
$loop: jp $loop ; Infinite branch to $loop lab?: jp lab? ; Infinite branch to lab? scope ; New local label scope $loop: jp $loop ; Reuse $loop lab?: jp lab? ; Reuse lab?
Notice that you have to use extended addressing to be able to access these registers. They are not in range of standard 8 bit addressing.
Please submit corrections, suggestions, and new documentation here: Submit a ticket
← Return to Reference Index
This is not an official Zilog website. Zilog nor 8times8 are liable for any damage done to equipment. Tutorial and reference copyright ©8times8 Creative Commons CC-0 License (public domain.) This reference uses content from Zilog's technical datasheets. Fair use only. Datasheets copyright © 2013 Zilog®, Inc. Z8, Z8 Encore!, Z8 Encore! XP and Z8 Encore! MC are trademarks or registered trademarks of Zilog, Inc. Read Zilog's terms at zilog.com
Website design by Koen van Vliet. Hosted by sourceforge.net