Microprocessors
533
SUB R
Subtracts the contents of the register from the accumulator
SUI eight-bit Subtracts eight-bit data from the contents of the accumulator
INR R
Increments the contents of the register
DCR R
Decrements the contents of the register
13.4.3 Logic Instructions
Microprocessors can perform all the logic functions of hard-wired logic. The basic logic operations
performed by all microprocessors are AND, OR, NOT and EXCLUSIVE-OR. Other logic operations
include ‘shift’ and ‘rotate’ operations. All these operations are performed on a bit-for-bit basis on bytes
or words. For instance, 11111111 AND 10111010 equals 10111010, and 11111111 OR 10111010
equals 11111111. Some microprocessors also perform bit-level instructions such as ‘set bit’, ‘clear bit’
and ‘complement bit’ operations. It may be mentioned that logic operations always clear the carry and
overflow flags, while the other flags change to reflect the condition of the result.
The basic shift operations are the ‘shift left’ and ‘shift right’ operations. In the shift left operation,
also known as the arithmetic shift left, all bits are shifted one position to the left, with the rightmost
bit set to ‘0’ and the leftmost bit transferred to the carry position in the status register. In the shift
right operation, also known as logic shift right, all bits are shifted one bit position to the right, with
the leftmost bit set to ‘0’ and the rightmost bit transferred to the carry position in the status register.
If in the shift right operation the leftmost bit is left unchanged, it is called arithmetic shift right. In
a ‘rotate’ operation, the bits are circulated back into the register. Carry may or may not be included.
As an illustration, in a ‘rotate left’ operation without carry, the leftmost bit goes to the rightmost bit
position, and, in a ‘rotate right’ with carry included, the rightmost bit goes to the carry position and
the carry bit takes the position of the leftmost bit.
Examples of logic instructions performed by the 8085 microprocessor include the following:
ANA R/M
Logically AND the contents of the register/memory with the contents of the
accumulator
ANI eight-bit Logically AND the eight-bit data with the contents of the accumulator
ORA R/M
Logically OR the contents of the register/memory with the contents of the
accumulator
ORI eight-bit Logically OR the eight-bit data with the contents of the accumulator
XRA R/M
Logically EXCLUSIVE-OR the contents of the register memory with the
contents of the accumulator
XRI eight-bit Logically EXCLUSIVE-OR the eight-bit data with the contents of the
accumulator
CMA
Complement the contents of the accumulator
RLC
Rotate each bit in the accumulator to the left position
RRC
Rotate each bit in the accumulator to the right position
13.4.4 Control Transfer or Branch or Program Control Instructions
Microprocessors execute machine codes from one memory location to the next, that is, they execute
instructions in a sequential manner. Branch instructions change the flow of the program either
unconditionally or under certain test conditions. Branch instructions include ‘jump’, ‘call’, ‘return’ and
‘interrupt’.
‘Jump’ instructions are of two types, namely ‘unconditional jump’ instructions and ‘conditional
jump’ instructions. If the microprocessor is so instructed as to load a new address in the program
533
SUB R
Subtracts the contents of the register from the accumulator
SUI eight-bit Subtracts eight-bit data from the contents of the accumulator
INR R
Increments the contents of the register
DCR R
Decrements the contents of the register
13.4.3 Logic Instructions
Microprocessors can perform all the logic functions of hard-wired logic. The basic logic operations
performed by all microprocessors are AND, OR, NOT and EXCLUSIVE-OR. Other logic operations
include ‘shift’ and ‘rotate’ operations. All these operations are performed on a bit-for-bit basis on bytes
or words. For instance, 11111111 AND 10111010 equals 10111010, and 11111111 OR 10111010
equals 11111111. Some microprocessors also perform bit-level instructions such as ‘set bit’, ‘clear bit’
and ‘complement bit’ operations. It may be mentioned that logic operations always clear the carry and
overflow flags, while the other flags change to reflect the condition of the result.
The basic shift operations are the ‘shift left’ and ‘shift right’ operations. In the shift left operation,
also known as the arithmetic shift left, all bits are shifted one position to the left, with the rightmost
bit set to ‘0’ and the leftmost bit transferred to the carry position in the status register. In the shift
right operation, also known as logic shift right, all bits are shifted one bit position to the right, with
the leftmost bit set to ‘0’ and the rightmost bit transferred to the carry position in the status register.
If in the shift right operation the leftmost bit is left unchanged, it is called arithmetic shift right. In
a ‘rotate’ operation, the bits are circulated back into the register. Carry may or may not be included.
As an illustration, in a ‘rotate left’ operation without carry, the leftmost bit goes to the rightmost bit
position, and, in a ‘rotate right’ with carry included, the rightmost bit goes to the carry position and
the carry bit takes the position of the leftmost bit.
Examples of logic instructions performed by the 8085 microprocessor include the following:
ANA R/M
Logically AND the contents of the register/memory with the contents of the
accumulator
ANI eight-bit Logically AND the eight-bit data with the contents of the accumulator
ORA R/M
Logically OR the contents of the register/memory with the contents of the
accumulator
ORI eight-bit Logically OR the eight-bit data with the contents of the accumulator
XRA R/M
Logically EXCLUSIVE-OR the contents of the register memory with the
contents of the accumulator
XRI eight-bit Logically EXCLUSIVE-OR the eight-bit data with the contents of the
accumulator
CMA
Complement the contents of the accumulator
RLC
Rotate each bit in the accumulator to the left position
RRC
Rotate each bit in the accumulator to the right position
13.4.4 Control Transfer or Branch or Program Control Instructions
Microprocessors execute machine codes from one memory location to the next, that is, they execute
instructions in a sequential manner. Branch instructions change the flow of the program either
unconditionally or under certain test conditions. Branch instructions include ‘jump’, ‘call’, ‘return’ and
‘interrupt’.
‘Jump’ instructions are of two types, namely ‘unconditional jump’ instructions and ‘conditional
jump’ instructions. If the microprocessor is so instructed as to load a new address in the program
