The program counter is a register that stores the address of the next instruction to be executed and hence plays a central role in controlling the sequence of machine instructions that the processor executes. After the instruction is read into the memory, the program counter is automatically incremented by ‘1’. This is of course on the assumption that the instructions are executed sequentially. Its contents are affected by jump and call instructions. In the case of a jump instruction, the program counter is first loaded with the new address and then incremented thereafter until another jump instruction is encountered. When the microprocessor receives an instruction to begin a subroutine, the contents of the program counter are incremented by ‘1’ and are saved in the stack. The program counter is loaded with the address of the first instruction of the subroutine. Its contents are incremented by ‘1’ until a return instruction is encountered. The saved stack contents are then loaded into the program counter and the program continues, executing each instruction sequentially until another jump instruction or a subroutine call is encountered. The interrupt process also alters the contents of the program counter.
The instruction register stores the code of the instruction currently being executed. The control unit extracts the operation code from the instruction register, which determines the sequence of signals necessary to perform the processing required by the instruction.
Buffer registers interface the microprocessor with its memory system. The two standard buffer registers are the memory address register (MAR) and the memory buffer register (MBR). The MAR is connected to the address pins of the microprocessor and holds the absolute memory address of the data or instruction to be accessed. The MBR, also known as the memory data register, is connected to the data pins of the microprocessor. It stores all data written to and read from memory.
The status register stores the status outputs of the result of an operation and gives additional information about the result of an ALU operation. The status of bits stored in the status register tells about the occurrence or nonoccurrence of different conditions, and one or more bits may be updated at the end of an operation. Each bit is a Boolean flag representing a particular condition. The most common conditions are the carry, overflow, zero and negative. For instance, a ‘1’ in the carry status bit position shows that the result of the operation generates a carry. The significance of the status register lies in the fact that the condition code set by the status of different bits in the status register forms the basis of decision-making by the microprocessor during the execution of a program.
The stack pointer is a register used to store the address of a memory location belonging to the most recent entry in the stack. In fact, a stack is a block of memory locations designated for temporary storage of data. It is used to save data of another general-purpose register during execution of a subroutine or when an interrupt is serviced. The data are moved from a general register to the stack by a PUSH instruction at the beginning of a subroutine call, and back to the general register by a POP instruction at the end of the subroutine call. Microprocessors use a stack because it is faster to move data using PUSH and POP instructions than to move data to/from memory using a MOVE instruction.
There is a set of registers for general-purpose use, designated as general-purpose registers. They are used explicitly to store data and address information. Data registers are used for arithmetic operations, while the address registers are used for indexing and indirect addressing. These enhance the processing speed of the microprocessor by avoiding a large number of external memory read/write operations while an ALU operation is being performed, as it is much easier and faster to read from or write into an internal register than to read from or write into an external memory location. Earlier microprocessors had only one register called the accumulator for ALU operations. It needed at least four assembly language instructions to perform a simple addition, including carrying data from an external memory location to the accumulator, adding the contents of the accumulator to those of another memory location, storing the result in the accumulator and transferring the contents of the accumulator back to the external memory location. With the availability of a greater number of general-purpose registers, it would be possible to perform many ALU operations without even a need to store data in external memory.