Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

8086 Microprocessor Register

Instructor: Bijan Paul


Senior Lecturer
University of Liberal Arts Bangladesh
Different types of Register in 8086

2
General Purpose Registers of 8086
◼ All general registers of the 8086 microprocessor can be used for arithmetic and logic
operations.

◼ There are 8 general purpose registers, i.e., AH, AL, BH, BL, CH, CL, DH, and DL.

◼ These registers can be used individually to store 8-bit data and can be used in pairs
to store 16bit data.

◼ The valid register pairs are AH and AL, BH and BL, CH and CL, and DH and DL. It is
referred to the AX, BX, CX, and DX respectively.

◼ AX Register:
◼ AX register is also known as accumulator register.

◼ The lower 8-bits of AX are designated to use as AL and higher 8-bits as AH.

◼ This Accumulator used in arithmetic, logic and data transfer operations.

◼ For manipulation and division operations, one of the numbers must be placed in
AX or AL.

◼ Input and output operations also require the use of AL and AX.
3
General Purpose Registers of 8086
◼ BX Register:

◼ This register is mainly used as a base register.

◼ BX is a 16 bit register, but BL indicates the lower 8-bits of BX and BH indicates


the higher 8-bits of BX.

◼ It holds the starting base location of a memory region within a data segment.

◼ CX Register:

◼ It is defined as a counter register.

◼ It is primarily used in loop instruction to store loop counter.

◼ The register CX is used default counter in case of string and loop instructions.

◼ Count register can also be used as a counter in string manipulation and


shift/rotate instruction.

◼ DX Register:

◼ DX register is used in multiplication and division.

◼ It is also used in I/O operations. 4


Segment Register
◼ Segment register holds the addresses of instructions and data in memory,
which are used by the processor to access memory locations.

◼ BIU has 4 segment buses, i.e. CS, DS, SS& ES.

◼ Code Segment (CS): 16-bit register that points at the segment


containing where you store the program. The code segment (Also called
text segment) contains instructions.

◼ Data Segment (DS): 16-bit register that generally points at segment


where data is stored.

◼ Stack Segment (SS): 16-bit register that points at the segment


containing the stack.

◼ Extra Segment (ES): 16-bit register that is additional data segment that
is used by some of the string to hold the destination data.
5
Segmentation
◼ Segmentation is the process in which the main memory of
computer is divided into different segments and each segment has
its own base address.

◼ Segmentation is used to increase the execution speed of computer


system so that processor can able to fetch and execute the data
from memory easily and fastly.

6
Memory Segment
◼ In order to explain the function of segment register, we first need to
introduce the idea of memory segments, which is a direct consequence of
using a 20-bit address in a 16-bit processor.
◼ The addresses are too big to fit in a 16-bit register.
◼ 8086 can work with only 64KB segments at a time within this 1MB of
memory.
◼ The 8086 gets around the problem by partitioning the memory into
segments.
◼ A memory segment is a block of 216 or 64 K consecutive memory bytes.
Each segment is identified by a segment number starting from 0.
◼ A segment number is 16 bits, so the highest segment number is FFFFh.
◼ Within a segment, a memory location is specified by giving an offset.
◼ This is the number of bytes from the beginning of the segment.
◼ With a 64-KB segment, the offset can be given as a 16-bit number.
◼ The first byte in a segment has offset 0. The last offset in a segment in
FFFFh. That means total 16 segment but for programming purpose you
can use only 4 segments.
7
Memory Segment

8
Segment: Offset Memory address
◼ A memory location may be specified by providing a segment
number and an offset, written in the form segment: offset; this
is known as logical address.
◼ For example, A4FB:4872h means offset 4872h within segment
A4FBh.
◼ To obtain a 20-bit physical address, the 8086 microprocessor first shifts the
segment address 4 bits to the left(this is equivalent to multiplying by 10h), and
then adds the offset.
◼ Thus the physical address for A4FB:4872h is
A4FB0h
+ 4872h
_____________
A9822h(20-bit physical address)

◼ Formula:
Physical address = segment * 10 h + offset

9
Example
◼ A memory location has physical address 80FD2h. In what segment
does it have offset BFD2h.
◼ Solution: We know that,
Physical address = segment * 10 h + offset

Thus,
segment * 10 h = Physical address - offset

In this example,
Physical address = 80FD2h
- offset = BFD2h
_______________________________________
segment * 10 h = 75000h

So, the segment must be 7500h.

10
End

11

You might also like