High School Physics

Special-purpose registers in 8085 microprocessor

Last updated on May 26th, 2022 at 05:13 am

In this post, we will study the Special-purpose registers in the 8085 microprocessor with the help of a bunch of Frequently Asked Questions.

Describe the special-purpose registers in 8085

Special-purpose Registers are dedicated to a specific function. The accumulator, flag register, program counter (PC), and stack pointer (SP) constitute the special purpose registers in the 8085 microprocessor.

The special-purpose registers used in the 8085 microprocessor are:

  • Accumulator register (A)
  • Status (or Flag) register
  • Stack pointer register (SP)
  • Program counter register (PC)

What are the sixteen-bit registers in 8085?

8085 has two (2) sixteen-bit registers and these are known as Program Counter (PC) and Stack Pointer (SP) register.

Program Counter | PC

The program counter (PC) is a sixteen-bit register that contains the address of the instruction to be executed just next. PC acts as an address pointer (also known as memory pointer) to the next instruction. As the processor executes instructions one after another, the PC is incremented – the number by which the PC increments depends on the nature of the instruction.

For example, for a 1-byte instruction, the PC is incremented by one, while for a 3-byte instruction, the processor increments the PC by three address locations.

stack pointer

The stack pointer (SP) is a sixteen-bit register that points to the ‘stack’. The stack is an area in the R/W memory where temporary data or return addresses (in cases of subroutine CALL) are stored.

The stack top is initialized by the SP by using the instruction LXI SP, 16-bit memory address.

In the memory map, the program should be written at one end and the stack should be initialized at the other end of the map – this is done to avoid crashing of program.

If a sufficient gap is not maintained between program memory location and stack, then when the stack gets filled up by PUSH or subroutine calls, the stack top may run into the memory area where the program has been written. This is shown in Figure 1

Figure 1: Auto-increment and auto-decrement facility for PC and SP respectively

Describe the instruction register in 8085

The program written by the programmer resides in the R/W memory.

When an instruction is being executed by the system, the opcode of the instruction is fetched from the memory and stored in the instruction register.

The opcode is loaded into the instruction register during the opcode fetch cycle. It is then sent to the instruction decoder.

Describe the (status) flag register in 8085

It is an 8-bit register in which five-bit positions contain the status of five condition flags which are Zero (Z), Sign (S), Carry (CY), Parity (P), and Auxiliary carry (AC).

Each of these five flags is a 1-bit F/F. The flag register format is shown in Figure 2

Figure 2: The flag register format in 8085 microprocessor

5 Flags & their significance

  • Sign (S) flag: – If the MSB of the result of an operation is 1, this flag is set, otherwise it is reset. This flag indicates the sign of the number.
  • Zero (Z) flag:– If the result of an instruction is zero, this flag is set, otherwise, reset.
  • Auxiliary Carry (AC ) flag:– If there is a carry out of bit 3 and into bit 4 resulting from the execution of an arithmetic operation, it is set otherwise reset. This flag is used for BCD operation and is not available to the programmer to change the sequence of instructions.
  • Carry (CY) flag:– If an instruction results in a carry (for addition operation) or borrow (for subtraction or comparison) out of bit D7, then this flag is set, otherwise, reset.
  • Parity (P) flag:– This flag is set when the result of an operation contains an even number of 1’s and is reset otherwise.

What are the temporary registers of 8085?

The temporary registers of 8085 are the temporary data register and W and Z registers. These registers are not available to the programmer, but 8085 uses them internally to hold temporary data during the execution of some instructions.

Describe W and Z registers of 8085

W and Z are two 8-bit temporary registers, used to hold 8-bit data/address during the execution of some instructions.

CALL-RET instructions are used in subroutine operations. On getting a CALL in the main program, the current program counter content is pushed into the stack and loads the PC with the first memory location of the subroutine. The address of the first memory location of the subroutine is temporarily stored in the W and Z registers.

Again, XCHG instruction exchanges the contents H and L with D and E respectively. W and Z registers are used for the temporary storage of such data.

Describe the function of the accumulator register of 8085

This 8-bit register is the most important one amongst all the registers of 8085. Any data input/output to/from the microprocessor takes place via the accumulator (register). It is generally used for the temporary storage of data and for the placement of the final result of arithmetic/logical operations. The Accumulator (ACC or A) register (a part of the ALU) is extensively used for arithmetic, logical, store, and rotate operations.

What is the function of the internal data bus?

The width of the internal data bus is 8-bit and carries instructions/data between the CPU registers. This is totally separate from the external data bus which is connected to memory chips, I/O, etc.

The internal and external data buses are connected together by a logic called a bidirectional bus (trans-receiver).

Related Posts

Here are links to the articles we published on the Architecture of the 8085 microprocessor.

Functional block diagram of Intel 8085 microprocessor and the functional units

General-purpose registers of 8085 microprocessor

Special-purpose registers of 8085 microprocessor – FAQs

Different Signals used in 8085 microprocessor & their significance – FAQs

Author of this post

This post is co-authored by Professor Saraswati Saha, who is an assistant professor at RCCIIT, a renowned degree engineering college in India. Professor Saha teaches subjects related to digital electronics & microprocessors.

See also  Memory interfacing in 8085 with RAM and ROM
Scroll to top