The Wayback Machine - https://web.archive.org/web/20250127205554/https://www.geeksforgeeks.org/general-purpose-registers-8086-microprocessor/
Open In App

General purpose registers in 8086 microprocessor

Last Updated : 12 Aug, 2024
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

It is one of the most important chips ever created due to its part in the development of x86-based architecture. One significant aspect of this microprocessor is that it contains general registers. Efficiency and speed of computations in the processor are influenced by these registers since they determine arithmetic operations execution and data manipulations. Understanding such registers is important for code optimization as well as assembly language programming and system design.

The 8086 microprocessor contains a set of 16-bit general-purpose registers which are used for performing various arithmetic, logical, and data movement operations. Since these registers are flexible and can assume different combinations to perform various functions, they form the basic operation units of the processor itself.

General-purpose registers are used to store temporary data within the microprocessor

There are 8 general-purpose registers in the 8086 microprocessor.

1. AX: This is the accumulator. It is of 16 bits and is divided into two 8-bit registers AH and AL to also perform 8-bit instructions. It is generally used for arithmetical and logical instructions but in 8086 microprocessor it is not mandatory to have an accumulator as the destination operand. Example:

ADD AX, AX (AX = AX + AX)

2. BX: This is the base register. It is of 16 bits and is divided into two 8-bit registers BH and BL to also perform 8-bit instructions. It is used to store the value of the offset. Example:

MOV BL, [500] (BL = 500H)

3. CX: This is the counter register. It is of 16 bits and is divided into two 8-bit registers CH and CL to also perform 8-bit instructions. It is used in looping and rotation. Example:

MOV CX, 0005
LOOP

4. DX: This is the data register. It is of 16 bits and is divided into two 8-bit registers DH and DL to also perform 8-bit instructions. It is used in the multiplication and input/output port addressing. Example:

MUL BX (DX, AX = AX * BX)

5. SP: This is the stack pointer. It is of 16 bits. It points to the topmost item of the stack. If the stack is empty the stack pointer will be (FFFE)H. Its offset address is relative to the stack segment.

It is AB and manage the present position of the top of the stack.

Example: To push or pop data from the stack in a function call, the SP is altered.

PUSH R1 ; Decrement the SP and then store the value of R1 that is at SP.
R1 = POP; R1 = increment SP; R1 = get value in SP

6. BP – This is the base pointer. It is of 16 bits. It is primarily used in accessing parameters passed by the stack. Its offset address is relative to the stack segment.

MOV AX, [BP+4] ; Access a parameter passed to the function 
(4 bytes above BP in the Stack)

7. SI – This is the source index register. It is of 16 bits. It is used in the pointer addressing of data and as a source in some string-related operations. Its offset is relative to the data segment.

MOV AL, [SI] ; Move the byte at the address pointed to by SI into the AL register
(used as a pointer to source data).

8.DI – This is the destination index register. It is of 16 bits. It is used in the pointer addressing of data and as a destination in some string-related operations. Its offset is relative to the extra segment.

MOV [DI], AL; Move the byte in AL to the address pointed to by DI
(serves as the destination for the data).

Advantages

  • Versatility: The general-purpose registers are usually useful in arithmetic processing, data movement and memory addressing making them quite flexible.
  • Efficiency: Data manipulation that is done on registers is quicker than one that involves memory and thus more efficient code is created.
  • Ease of Use: Registers help to ease programming operations since they allow direct handling on operands and result as opposed to requiring the programmer to deal with memory storage.

Disadvantages

  • Limited Number: The 8086 microprocessor for example has fewer number of general purpose registers that are suitable for organizational use hence word usage can be restricted by the limitation of the available registers in the microprocessor.
  • Size Constraints: Both registers are of 16 bits, and thus not suitable for applications that involve large data or high precision values in registers.
  • Complexity in Management: There is usually a challenge in managing and optimizing the use of the available registers in the assembly languages due to profound knowledge of the processor’s architecture and available instruction set.

Conclusion

The modes of 8086 microprocessor are of great importance as it gives them ability to work hence creating the ability to handle different tasks in a friendly and efficient way. Each of the registers has its uses and roles but this doesn’t mean that it cannot be used in other areas. Thus if programmers know what these registers and the tasks that they are used for, then they have the ability to develop better assembly code that will programs well optimized for 8086 based systems. This enables data stored in these registers to be readily accessible and get modified as it is one of the principles in system design commonly in low level programming.

Frequently Asked Questions on General purpose registers in 8086 microprocessor-FAQ’s

As applied to the mentioned microprocessor what is the function played by Accumulator Register (AX)?

The AX register refers to the Accumulator register, this is significant in the arithmetic operations, input or output operations together with the general purpose operations. It is mainly used where there is an operation that produces a result that is retained and used or referred to.

This paper aims at answering the following question: How exactly does the count register (CX) improve the flow of loops?

The count register is CX and it is used in invoking the number of times in a loop operation or use of string. It is useful in establishing the number of times circles within a piece of code or a data set need to be repeated.

This of course refers to the high and low bytes in the general-purpose registers: Are there advantages to having these split up as such?

It must be noted that separation into high and low bytes provides more vital directives for data processing. It allows manipulation of the 8-bit data within a 16-bit register which makes it more convenient to handle byte level operations and makes the processor more versatile at data processing.


Next Article

Similar Reads

three90RightbarBannerImg