Sie sind auf Seite 1von 5

Introduction to 8086

Register Organization

THEORY

INTRODUCTION TO 8086
Register Organization:
In 8086 there are 2 types of registers
1) general purpose register
2) special purpose registers.
These registers, in general are 16 bit registers.
The general purpose registers can be used as 16 or 8 bit
registers.
General purpose registers are generally used for
1) holding data,
2) holding variables,
3) holding intermediate results temporarily for other
purposes like counter,
4) holding offset for some addressing modes.
Special purpose registers are used for
1) holding segment registers,
2) holding index registers,
3) holding offset storing registers for particular addressing
mode.
Registers are the four types of
1) general data registers
2) segment registers
3) pointer and index register and
4) flag registers.

Introduction to 8086

Register Organization

THEORY

General Data Register:

Fig. General data registers (GDR)

General data registers (GDR) have 4 registers namely AX, BX,


CX & DX.
Now, this AX can be used as 8 bit registers namely ah and al,
where h stands for higher by 8 bits and l stands for lower 8
bits.
Similarly the remaining three registers can be used as bh, bl
(for BX), ch, cl (for CX) and dh, dl (for DX).
Segment Register:

Fig. Segment registers

Segment registers have four type of registers namely CS


(code segment), DS (data segment), ES (extra segment) and
SS (stack segment).
These registers generally point to memory location where
these respective segments reside in memory.
For egs.
2

Introduction to 8086

Register Organization

THEORY

CS would hold base pointer of code segment, similarly DS for


data segment, SS for stack segment and ES for extra segment.
Extra segment is another data segment of the memory.
Pointer and Index Register:

Fig. Pointer and Index registers

Now pointer and index register generally have 5 registers


namely stack pointer (SP), buffer pointer (BP), source index
(SI), destination index (DI) and instruction pointer (IP).
Stack pointer generally contains the top value of the stack.
Pointer is generally used for accessing any content anywhere
in the stack.
The source index contains the offset value of the source
while the destination index contains the offset of the
destination.
The instruction pointer points to the current instruction that
is being executed.
They are used as GPR and offset storage in case of indexed,
base indexed and relatively based indexed addressing modes.
The SI is used to store offset of source data while DI is used
to store offset of destination data.

Introduction to 8086

Register Organization

THEORY

Flags:

Fig. Flag registers

The flag register contains 16 bits in which 9 beds are being


used they are carry flag (C), parity flag (P), auxiliary carry flag
(Ac), zero flag (Z), sign flag (S), trap flag (T), interrupt flag (I),
direction
flag
(D)
and
overflow
flag
(O).
Now we talked about these registers and now we will talk
about how actually we address any memory location.
Basically a memory location has 2 parts- base and offset.
The segment registers hold base addresses of their respective
segments and any GDR can have offset addresses.
Advantage of this system is we are addressing 1 MB of
memory using two 16 bits registers.
This is done by shifting the base address by 4 bits to the left
and then adding the offset in it.
By this way we get the physical address.
eg. say the base is 5855H and offset is 0105H. So the physical
address is calculated as
BASE:
BASE (after shifting):
OFFSET:

0101

0101
0100
0000

0100
0101
0001

0101
0101
0000

0101
0000
0101

(segment register has this)


(segment register has this)
(GDR has this)

PHYSICAL ADDRESS:

0101

0100

0110

0101

0101

(20 bit physical address)

You just saw, how we calculate the physical address using 2


16 bit addresses. As the offset is 16 bits, the size of the
memory segment will be 64 kb, so each segment in 8086 will
be of 64 kb in size.
Let us see the memory segmentation in 8086.
4

Introduction to 8086

Register Organization

THEORY

Memory segmentation:
In this physical available memory is divided into logical
segments. Each segment is of size 64 kb. The 16 bit contents
of the segment register actually points to the starting
location of a particular segment.
And in order to address any location in the segment, we use
offsets, which is again 16 bit addresses.
So the base address is from 0000 h to F000 h.
Offset address is from 0000 h to FFFF h.
Physical address becomes 00000 h to FFFFF h.
Memory segments are actually of two types:1) non overlapping
2) overlapping.
Advantages of memory segmentation are as follows:
1) allows the memory capacity to be 1 MB (Although the
addresses handled are 16 bits).
2) allows the placing of code, data and stack portion of the
same program in different parts of memory, for code and
data protection.
3) Permits a program and/or its data to be put in different
areas of memory, each time the program is executed.

Das könnte Ihnen auch gefallen