Microprocessors perform various basic operations that include data transfer instructions, arithmetic instructions, logic instructions, control transfer instructions and machine control operations. This set of commands (instructions set) used to control the functions of a microprocessor is specific to a given microprocessor. In this article, we look at examples of these instructions focusing on Intel 8085 microprocessor.
Contents
Data Transfer Instructions
Data transfer instructions transfer data from one location designated as the source location to another location designated as the destination. The data transfer could take place from one register to another, from one memory location to another memory location, from a memory location to a register or from a register to a memory location, and so forth. In other words, they are referred to as data movement operations as the contents of the source are not transferred but are copied into the destination register, without modifying the contents of the source. Also note that, these operations do not affect the flags.
Data transfer operations of 8085 microprocessor are of three types, namely MOVE, LOAD and STORE.
Table 1.0 Data Transfer Operations
Data transfer instructions | Descriptions |
MOV destination, source | Copy data from the source to the destination location. |
LDA address | Copy the data byte at the memory location specified by the 16-bit address of the accumulator. |
STA address | Copy the data from the accumulator to the memory location specified by the 16-bit address. |
Arithmetic Instructions
Arithmetic instructions performed by microprocessors include addition, subtraction, multiplication, division, comparison, negation, increment and decrement. A number of 8-bit microprocessors donโt support multiplication and division operations. These operations are supported by the 16-bit and 32-bit microprocessors. The arithmetic operations supported by the 8085 microprocessor are: addition, subtraction, increment and decrement operations. Examples of 8085 microprocessor instructions are as indicated in the table below:
Table 1.1 Arithmetic Instructions
Arithmetic Instruction | Descriptions |
ADD R | Adds the contents of the register to the accumulator. |
ADI d8 | Adds the 8-bit data to the accumulator. The d8 stands for any 8-bit or 1-byte data. |
SUB R | Subtracts the contents of the register from the accumulator. |
SUI d8 | Subtracts 8-bit data from the contents of the accumulator. |
INR R | Increments the contents of the register. |
DCR R | Decrements the contents of the register. |
Logic Instructions
Microprocessors can perform all the logic functions of hard-wired logic. The basic 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 example, 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 is important to note that, logic operations always clear the carry and overflow flags, while the other flags change to reflect that condition of the result.
The basic shift operations are the shift left and shift right operations. In the shift left operation, also referred to 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 referred to 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 example, in a rotate left with carry included, the rightmost bit goes to the carry position and the carry bit takes the position of the leftmost bit.
Examples 8085 microprocessor logic instructions are given in the table below:
Table 1.2 Logic Instructions
Logic Instructions | Descriptions |
ANA R/M | Logically AND the contents of the register/memory with the contents of the accumulator. |
ANI d8 | Logically AND the 8-bit data (d8) with the contents of the accumulator. |
ORI d8 | Logically OR the 8-bit data (d8) with the contents of the accumulator. |
XRA R/M | Logically EXCLUSIVE-OR the 8-bit data with the contents of the register memory 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. |
Transfer Control or Branch or Program Control Instructions
Microprocessors execute machine codes from one memory location to the next, i.e. they execute instructions is a sequential manner. Branch instructions change the flow of the program either unconditionally or under certain test conditions. Branch instructions include โjumpโ, โcallโ, 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 counter and start executing instructions at that address, it is referred to as unconditional jump. In the case of a conditional jump, the program counter is loaded with a new instruction address only if and when certain conditions are determined by the microprocessor after reading the appropriate status register bits. โCallโ instructions transfer the flow of the program to a subroutine. The โcallโ instruction differs from the โjumpโ instruction as โcallโ saves a return address (the address of the program counter plus one) on the stack. The โreturnโ instruction returns the control to the instruction whose address was stored in the stack when the โcallโ instruction was encountered. โInterruptโ is hardware-generated call (externally driven from a hardware signal) or a software-generated call (internally derived from the execution of an instruction or by some internal event).
Examples of 8085 microprocessor transfer control instructions are as shown in the table below:
Table 1.3 Transfer Control Instructions
Transfer Control Instructions | Descriptions |
JMP 16-bit address | Change the program sequence to the location specified by the 16-bit address. |
JZ 16-bit address | Change the program sequence to the location specified by the 16-bit address if a zero flag is set. |
JC 16-bit address | Change the program sequence to the location specified by the 16-bit address if a carry flag is set. |
CALL 16-bit address | Change the program sequence to the location of the subroutine specified by the 16-bit address. |
RET | Return to the calling program. |
Machine Control Instructions
Machine control instructions include HALT and NOP instructions. Machine control instructions that are performed by the 8085 microprocessor include:
Table 1.4 Machine Control Instructions
Machine Control Instructions | Descriptions |
HLT | Stop processing and wait. |
NOP | No operation. |
You may also read:
- Basic Architecture of a Microprocessor
- Basic Features of a Microprocessor-Based System
- An Overview of Assembly Language for Programming Microcontrollers
- The MOV Instruction in Intel 8051 (MCS-51) Microcontroller
- Position Control using a Microprocessor-based Controller
- The Basic Structure of Intel 8051 Microcontroller
Leave a Reply