Wednesday, March 23, 2016

8051 Jump if Accumulator Zero

Jump if Accumulator Zero - JZ relative address

If all bits of the Accumulator are 0, JZ branches to the address indicated; otherwise, it proceeds with the next instruction. The branch destination is computed by adding the signed relative-displacement in the second instruction byte to the PC, after incrementing the PC twice. The Accumulator is not modified. No flags are affected.

Encoding: 0 1 1 0 0 0 0 0 rel address

The Accumulator originally contains 01H. The following instruction sequence,

JZ LABEL1
DEC A
JZ LABEL2

changes the Accumulator to 00H and causes program execution to continue at the instruction identified by the label LABEL2.

Example:
ORG 0H
MAIN :
MOV A, #00H
MOV P0, #00H
BEGIN :JZ LABEL1
DEC A
JZ LABEL2
LABEL1 :INC A
MOV P0, #55H
AJMP BEGIN
LABEL2 :MOV P0, #0AAH
AJMP MAIN
END



Related topics:
8051 Unconditional and Conditional Jump   |   8051 Long Jump   |   8051 Absolute Jump   |   8051 Short Jump   |   8051 Indirect Jump   |   8051 Jump if Accumulator Not Zero   |   8051 Compare and Jump if Not Equal   |   8051 Decrement and Jump if Not Zero   |   8051 Jump if Carry is Set   |   8051 Jump if Carry is Not Set   |   8051 Jump if Bit Set   |   8051 Jump if Bit Not Set   |   8051 Jump if Bit is Set and Clear Bit

List of topics: 8051

No comments:

Post a Comment