TJNZ

Instruction: Test value and jump to address if not zero.

TJNZ Value, < # >Address

  • Value (d-field) is the register to test.
  • Address (s-field) is the register or a 9-bit literal whose value is the address to jump to when Value contains a non-zero number.

Opcode Table:

–INSTR– ZCRI  –CON–    –DEST–         –SRC–

Z Result

C Result

Result

Clocks

 111010    000i    1111    ddddddddd    sssssssss

D = 0

0

Not Written

4 or 8

Concise Truth Table:

In

Out

Destination

Source

Z

C

Effects

Destination1

Z

C

$0000_0000; 0

$----_----; -

-

-

wr wz wc

$0000_0000; 0

1

0

$0000_0001; 1

$----_----; -

-

-

wr wz wc

$0000_0001; 1

0

0

1 Destination is not written unless the WR effect is given.

Explanation

TJNZ tests the Value register and jumps to Address if it contains a non-zero number.

When the WZ effect is specified, the Z flag is set (1) if the Value register contains zero.

TJNZ requires a different amount of clock cycles depending on whether or not it has to jump. If it must jump it takes 4 clock cycles, if no jump occurs it takes 8 clock cycles. Since loops utilizing TJNZ need to be fast, it is optimized in this way for speed.

Unless otherwise noted, content on this site is licensed under the
Creative Commons Attribution-ShareAlike 4.0 International License.