Вы находитесь на странице: 1из 11

MICROPROCESSOR 8086

LECTURE 33
8086 REGISTERS AND ADDRESSING MODES
Sukantho Sikder
REGISTERS OF
8086
• General Purpose Accumulator AH AL
AX General
Registers BH BL
Purpose
Base BX CH CL
• Pointer and Index Counter DH DL Register
CX
Registers SP
Data
DX BP Pointer
• Segment Registers and
Stack Pointer SI
Index
• Instruction Pointer Base Pointer DI register
Source Index CS
• Status Flags Segmen
Destination DS t
Index SS Register
Code Segment ES
Data Segment IP
Stack Segment FLAGS
Extra Segment
MEMORY SEGMENT AND SEGMENT
REGISTER
CODES
Code Segment of the
memory holds the • A segment register points to the
SEGMEN instruction codes of a starting address of a memory
T program
segment currently being used.
Extra Segment holds the • 8086 instructions specify 1 6- b it
EXTRA destination addresses of
SEGMENT some data of certain string memory address whereas the actual
instructions addresses are of 20 bits. They are
calculated using the contents of the
STACK Stack segment holds segment registers and effective
SEGMENT addresses and data of memory address.
subroutines. It also holds
the contents of register or • Content of stack pointer and the stack
memory given in PUSH segment register are used to
DATA instruction. compute the address of the stack
SEGMENT location to be accessed.
Data, Variables and • The index registers SI and DI together
1 MB constants given in the
SEGMENTE program are held in the data with Data segment register and extra
D MEMORY segment of the memory segment register are used to perform
INSTRUCTION POINTER
• It acts as a program counter.
• It points to the address of the next instructions to be executed.
• Its content is automatically incremented when the execution of
a program proceeds further.
• The content of the instruction pointer and the content of the
code segment register are used to compute the memory
address of the instruction code to be fetched.
STATUS REGISTER
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
X X X X OF DF IF TF SF ZF X AF X PF X CF

Overflow flag
Direction flag
Carry flag
Interrupt
Parity flag
Enable flag
Auxiliary
Trap Flag Carry flag
Directional flag is used in string
The overflow
operation. If itflag is set
is set to to
1, 1,string Zero flag
bytes
Whenif the
Trapresult
Interrupt
are flag
accessed of signed
flag (IF)
(TF) isisset
settoto
from 11,toa
higher
operation
enablecan
memory
program becomes
INTRbe of
address out
run8086.
to
in of
Iflower
single it is
step
Sign flag
memory0,address.range
INTR is When
mode. disabled it is set to
0, string bytes are accessed from
lower to higher memory address.
ADDRESSING MODES OF 8086
• Register Addressing- In this addressing mode the operand is
placed in one of the 16 bit or 8 bit general purpose register.
MOV AX,CX or ADD AL,BL or ADD CX,DX
• Immediate Addressing- In this addressing mode the operand is
specified in the instruction itself.
MOV AL,35H or MOV BX,0206H
The remaining six addressing modes specify the location of an
operand which is placed in a memory. The memory address of an
operand consists of two components: the starting address of the
memory segment and an offset.
LOCATING MEMORY ADDRESS OF OPERAND
Code segment memory
2000
CODE SEGMENT 20000
REGISTER 20001 Offset
89 20002 When an operand
EXTRA SEGMENT is stored in a
REGISTER ------
memory location,
STACK SEGMENT ------ how far the
REGISTER ------ operand’s memory
location is within
DATA SEGMENT 20009
me a memory
Segnt RReEgGsi SI teTrEsR segment from the
starting address
An offset is determined by adding any combination of
of the segment is
three address elements: Displacement, base and index.
called offset.
The combination depends on the addressing mode of
the instruction.
MDiesmploarcyemadednrte: sIst
+insotfrfuscettion
=isSaat nrt8ni bgitaodrdr1e6ssbiotfimmmemedoiraytesevgamlueengtiven in the
Base: It is the content of the base register: BX or BP
ADDRESSING MODES
(CONTD.)
• Direct Addressing- In this addressing mode the operand’s offset is
given in the instruction as an 8 - b i t ot 16 - b i t displacement element.
ADD AL,[0303]
This instruction adds the content of the offset address 0303 to AL. The
operand is placed at the given offset [0303] within the data segment.
• Register indirect addressing- The operand’s offset is placed in
anyone one of the registers BP,BX,SI or DI.
MOV AX, [BX]
This instruction moves the contents of memory locations addressed by
the register BX to the register AX. For example, BX contains [0301]
and the content of 0301 is 53H and the content of the next memory
location is 95H. Then the 9553H will move to AX.
ADDRESSING MODES
(CONTD.)
Based Addressing- The operand’s offset is the sum of an 8 - b i t
or 1 6 - b i t displacement and contents of the base register BX or
BP. BX is used as a base register for data segment, and BP is used
as a base register for stack segment.
Offset (Effective address)=[BX+8-bit or 1 6 - b i t
displacement]
MOV AL,[BX+05]
Suppose, the register BX contains 0301. The offset will
be 0301+05=0306. The content of the memory location 0306
will move to AL.
ADDRESSING MODES
(CONTD.)
• Indexed Addressing- The operand’s offset is the sum of the content
of an index register SI or DI and an 8 - b i t or 1 6 - b i t displacement.
Offset=[SI or DI+8-bit or 1 6 - b i t displacement]
MOV AX,[SI+05]
• Based Indexed Addressing- The operand’s offset is the sum of the
content of a base register BX or BP and an index register SI or DI.
Offset=[BX or BP]+[SI or DI]
BX is used as a base register for data segment, and BP is used as a
base register for stack segment.
ADD AX,[BX+SI]
ADDRESSING MODES
(CONTD.)

Based Indexed with Displacement- The operand’s offset is
given by:
Offset=[BX or BP]+[SI or DI]+8-bit or 1 6 - b i t
displacement
MOV AX,[BX+SI+05] ; An example of 8 - b i t
displacement

Вам также может понравиться