8085 Microprocessor is an 8-bit general-purpose microprocessor. It is suitable for a wide range of applications. It is called an 8-bit microprocessor because it has an 8-bit internal data bus and can read, write and process 8-bit data at a time. The internal architecture of the 8085 microprocessor is shown below figure. This includes the following blocks:
8085 Microprocessor Architecture blocks
- Register block
- Arithmetic and Logic Unit (ALU) block
- Control Unit Block
- Interrupt Block
- Serial I/O Control Block
Register Block of 8085 Microprocessor has six general-purpose registers (B, C, D, E, H, and L) and two-pointer registers (SP and PC). The general-purpose registers are available to use by programmers through instructions. B, C, D, E, H, and L registers are 8 bit wide registers. These registers can be combined in a specific order to form 16 bit register. Specific ordered combined registers are also known as register pairs. BC, DE, and HL are three 16-bit register pairs.
These general-purpose registers are used to store the intermediate data and results. Since reading and storing in these registers do not require bus access so these are efficient for fast data processing and are also known as scratchpad registers. The contents of the register pair need not always have data. It may also have the address of the memory. Usually, the HL register pair content is considered to have the address of memory. It is implied that the assembly instruction refers to this address by mentioning M. Hence HL register pair is also used as a memory pointer. In each register pair, the first, register contains the higher-order and the second contains the lower-order byte.
W and Z registers are temporary registers that are not accessible to the user. W and Z temporary registers are 8 bits wide. The microprocessor uses these registers for storing the data or addressing temporarily it whenever required.
Two pointer registers are also available in the register block. These are the Program Counter (PC) and Stack Pointer (SP). Program Counter (PC) is a 16-bit register, which is used to point to the address of the next instruction to be executed. It keeps the track of memory addresses of the instructions in a program while they are being executed. The microprocessor increments the content of the program counter during the execution of an instruction so that it points to the address of the next instruction in the program at the end of the execution of an instruction. A stack Pointer (SP) is a 16-bit register that always points to the top of the stack. A stack is a part of memory that is used to store data temporarily. A stack operates on the last-in-first-out (LFO) concept. Only the top of the stack can be accessed because the stack pointer (SP) points to the top of the stack.
Note: In the register block, there is a special register that is not accessible to the user. This is a 16-bit register used by the microprocessor to increment/decrement the contents of the stack pointer (SP) and increment the contents of the program counter (PC) during the instruction execution.
Arithmetic and Logic Unit (ALU) Block
The arithmetic and logic unit (ALU) block contains the following units:
- Accumulator (A)
- Temporary Register (TR)
- Flag Register (FR)
- Arithmetic and Logic Unit (ALU)
The accumulator is an eight-bit tri-state register. The accumulator is loaded from the internal data bus and can transfer data to the internal data bus. Thus, it serves as both destination and source register. One of the operands and results of the arithmetic and logic operations is stored in the accumulator. The data in the accumulator can be rotated or shifted. No other register can be used to perform this operation. It is referred to as register A in the program. The bits of any register are referenced as D7 – D0 as shown below figure.
Bits of any register
Temporary Register (TR)
A temporary register is an 8-bit wide register. It is mostly used to store temporary data in arithmetic and logic instructions. It is not accessible to the user.
Flag Register (FR)
A flag register is a group of eight individual flip-flops, out of which five flip-flops are used to store significant information about the result of the arithmetic and logic operations. The other flip-flops have undefined values. The bits of the flag register and their condition codes are shown below figure.
Bits of any register
Carry Flag (CY)
If an arithmetic operation results in carrying, the carry flag is set (1); otherwise, it is reset (0). The carry flag also serves as a borrow flag for subtraction. The carry flag solves the dual purpose of showing carry and borrow in case of addition and subtraction respectively. It is represented by the D0 bit of the flag register.
Parity Flag (P)
This flag bit (D2) shows the result of the arithmetic operation is having an even number of ones or odd. Since the 8085 microprocessor follows an even parity system so if the number of ones in the accumulator after the arithmetic operation is even, this flag is set (1), otherwise, it is cleared (0).
Auxiliary Carry Flag (AC)
In an arithmetic operation when a carry is generated by the lower nibble and passed to the upper nibble, the auxiliary carry flag (AC) is set. This flag is used internally for BCD (Binary Coded Decimal) operations. the AC flag can not be used by the programmer. D4 bit of flip-flop represents the auxiliary carry flag.
Zero Flag (Z)
The zero flag shows that the result of any arithmetic or logic operation is zero or non-zero. The zero flags are set(1) when the result is zero; otherwise, it is reset(0). The zero flags are represented by the D6 bit of the flag register.
Sign Flag (S)
The sign flag is a replica of the D7 bit of the result. The sign flag is set (1) if bit D7 of the reset is 1; otherwise, it is reset (0). The sign flag is represented by the D7 bit of the flag register.
NOTE: Flags are modified only after the execution of an arithmetic or logic operation.
Arithmetic and Logic Unit (ALU)
The arithmetic and logic unit operates on one or two operands. The accumulator holds one operand. This unit is primarily responsible to perform bitwise arithmetic (addition and subtraction) and logic (NOT, OR, AND, Ex-OR, Rotate, clear, and set) operations with eight-bit capacity. The result of an arithmetic or logic operation is placed in the accumulator at the completion of the operator, replacing one of the original operands.
Control Unit Block
The control unit block plays an important role to control and synchronize all data transfers and transformations in the microprocessor system. The control unit block consists of
- Instruction Register (IR)
- Instruction Decoder and machine cycle Encoder
- Timing and control unit
Instruction Register (IR)
The instruction register is an eight-bit register. The instruction operation code (opcode) is originally stored in memory. This opcode is temporarily stored in the instruction register and then transferred to the instruction decoder and machine cycle encoder. This register is not accessible to the user.
Instruction Decoder and Machine Cycle Encoder
As the microprocessor first fetches the opcode (operation code for instruction) from memory and stores it in the instruction register. This opcode is then sent to the instruction decoder and machine cycle encoder which decodes the meaning of that opcode and accordingly gives the timing and control signals to register, ALU, data bus buffer, and sometimes also to external peripheral signals.
Timing and Control Unit
The basic operation of the microprocessor is regulated by the control unit. The control unit uses input from the master clock to generate timing and control signals. These signals are used to regulate the transfer and transformations of data with each instruction. A clock cycle is a period between two negative-going or two positive-going transitions of that clock. A state of one clock period is called T-state.
The interrupt is a process, which is initiated by an external device and is asynchronous. It can be initiated at any time without reference to the system clock. The response to an interrupt request is controlled by the interrupt block. 8085 microprocessor has five interrupts: TRAP, RST 7.5, RST 6.5, RST 5.5, and INTR. Interrupts can be categorized into maskable and non-maskable interrupts. TRAP is a non-maskable interrupt that can not be ignored, meaning that, if the microprocessor receives a TRAP interrupt request from the external device, the microprocessor has to respond to it. The remaining four interrupts are maskable and can be ignored.
Serial I/O Control Block
The 8085 microprocessor is the only 8-bit microprocessor that has separate pins for serial input and output operations. They are SID (Serial Input Data) and SOD (Serial Output Data) pins. For long-distance transmission, serial communication is preferable.