Register model
The register model of the Intel 8085 microprocessor consists of several types of registers that play an important role in storing and processing data and in executing programs. A detailed description of the various registers of the 8085 follows:
General-purpose registers
The B and C register pair
Each of the registers B and C is an 8-bit register. They can be used independently of each other to store 8-bit data. For example, you can use register B to hold a counter value and register C to hold a temporary data byte.
They can also be combined into the 16-bit register pair BC. Register B holds the high-order byte and register C holds the low-order byte. This is useful for operations that require 16-bit addressing or data handling, for example accessing a 16-bit memory location.
The D and E register pair
Like the BC pair, registers D and E are 8-bit registers that can be used independently or as the 16-bit register pair DE. Register D holds the high-order byte and register E holds the low-order byte. The pair can be used for tasks such as passing 16-bit parameters in subroutines or accessing a block of memory.
The H and L register pair
Registers H and L are 8-bit registers that form the HL register pair. This pair is very important because it can be used as a memory pointer. The 16-bit address formed by the HL pair can be used to access any memory location within the 64 KB address space of the 8085. For example, the instruction MOV A, M uses the HL register pair to point to a memory location and move the data from that location into the accumulator.
Accumulator (A)
The accumulator is an 8-bit register and is the most frequently used register in arithmetic and logical operations. It serves as the main storage for the results of operations performed by the arithmetic logic unit (ALU).
For example, in an addition operation such as ADD B, the contents of register B are added to the contents of the accumulator, and the result is stored in the accumulator. Many input/output operations also involve the accumulator, for example when data is transferred between the microprocessor and an input/output device.
Stack pointer (SP)
The stack pointer is a 16-bit register. It points to the top of the stack in memory. The stack is a special area of memory used to store return addresses during subroutine calls and interrupts, as well as for temporary data.
When a subroutine is called, the current value of the program counter (the address of the instruction following the call) is pushed onto the stack, and the stack pointer is decremented by one. When the subroutine returns, the value from the top of the stack is placed back into the program counter, and the stack pointer is incremented.
Program counter (PC)
The program counter is a 16-bit register that keeps track of the address of the next instruction to be fetched from memory. After each instruction is fetched and executed, the program counter is incremented so that it points to the next instruction in memory.
Control transfer instructions such as JMP (jump) and CALL (call subroutine) can change the value of the program counter, allowing the program to continue at another place in memory.
Flag register
The flag register is an 8-bit register, but only 5 of its bits are used as flags. These flags provide information about the results of arithmetic and logical operations.
Sign flag (S): indicates the sign of the result (set if the most significant bit of the result is 1).
Zero flag (Z): set if the result of the operation is zero.
Auxiliary carry flag (AC): used in BCD arithmetic to indicate a carry from the lower nibble to the upper nibble.
Parity flag (P): set if the number of ones in the result is even.
Carry flag (CY): set if there is a carry out of the most significant bit during addition or a borrow during subtraction.
Instruction register (IR)
Although the instruction register is not directly visible to the programmer when writing assembly language programs, it is an important internal register. It holds the instruction that is currently being decoded and executed by the control unit.
When an instruction is fetched from memory, it is loaded into the instruction register, after which the control unit interprets the instruction and generates the appropriate control signals to execute it.