Sunteți pe pagina 1din 49

8086 PROCESSOR

2
8086
8086 Physical memory organization

5
4. None 1 1
Functional Block Diagram of
8086

Memory Interface
Architecture Diagram
Memory Segmentation

Segment address * 10h +offset address

Segment add :1000


Offset address : 1234

Physical address = 11234


 Code segment:
 16 bit register
 Contains address of 64KB segment with
processor instruction
 Access the instructions which are referred by
Instruction pointer
 CS:IP
 Stack segment:
 16 bit register
 Contains address of 64KB segment with
program stack
 Used to access data pointed by SP and BP
 SS:SP/BP
 Data segment:
 16bit register
 Contains address of 64KB segment with
program data
 Used to access data referred by
AX,BX,CX,DX
 DS:AX/BX/CX/DX
 Extra segment:
 16bit register
 Contains address of 64KB segment with
program data
 Access data referenced by SI and DI
 ES:SI/DI
 Instruction Pointer:
 16 bit register
 Used to hold the address of next instruction

 Address summing block:


 Used to calculate physical address of 20bit
which helps in accessing contents in 8086.
Instruction Queue
 BIU uses pipelining concept
 It prefetches 6 bytes of instruction and store
 Whenever EU finishes executing its current
instruction it simply reads the instruction present in
instruction queue.
 No wastage of time in fetching instruction
 Execution time decreases
 FIFO manner
Execution Unit
 The Execution Unit (EU) has
 Control unit
 Instruction decoder
 Arithmetic and Logical Unit (ALU)
 General registers
 Flag register
 Pointers
 Index registers
Execution Unit
 Control unit is responsible for decoding the instructions

Note:
Assembly

Machine language(opcode)

Examples:
Mov al,cl
Mov al,05h)
 ALU performs various arithmetic and
logical operations over the data

 The instruction decoder translates the


instructions fetched from the memory into
a series of actions that are carried out by
the EU
Execution Unit - Registers
 General registers are used for temporary storage and manipulation of data and
instructions
Execution Unit - Flags
 Single-step Flag (TF) - if set then single-step interrupt will
occur after the next instruction

 Interrupt-enable Flag (IF) - setting this bit enables maskable


interrupts

 Direction Flag (DF) - if set then string manipulation


instructions will auto-decrement index registers. If cleared
then the index registers will be auto-incremented

 Overflow Flag (OF) - set if the result is too large positive


number, or is too small negative number to fit into destination
operand
Execution Unit - Flags
 Carry Flag (CF) - set if there was a carry from or borrow
to the most significant bit during last result calculation

 Parity Flag (PF) - set if parity (the number of "1" bits) of


the result is even.

 Auxiliary carry Flag (AF) - set if there was a carry from or


borrow to bits 0-3 in the AL register.

 Zero Flag (ZF) - set if the result is zero.

 Sign Flag (SF) - set if the most significant bit of the result
is set.
Segment and Address register
combination

 CS:IP

 SS:SP SS:BP

 DS:BX DS:SI

 DS:DI (for other than string operations)

 ES:DI (for string operations)

27
 Assembly
 Machine language(opcode)

 Examples:
 Mov al,cl
 Mov al,05h
Pin Diagram
Addressing Modes
 Implied Addressing – The data value/data address
is implicitly associated with the instruction
 Register Addressing – The data is specified by
referring the register or the register pair in which the
data is present
 Immediate Addressing – The data itself is provided
in the instruction
 Direct Addressing – The instruction operand
specifies the memory address where data is located
Addressing Modes
 Register indirect addressing – The instruction
specifies a register containing an address, where
data is located
 Based - 8-bit or 16-bit instruction operand is added
to the contents of a base register (BX or BP), the
resulting value is a pointer to location where data
resides
 Indexed - 8-bit or 16-bit instruction operand is added
to the contents of an index register (SI or DI), the
resulting value is a pointer to location where data
resides
Addressing Modes
 Based Indexed - the contents of a base register (BX
or BP) is added to the contents of an index register
(SI or DI), the resulting value is a pointer to location
where data resides
 Based Indexed with displacement - 8-bit or 16-bit
instruction operand is added to the contents of a
base register (BX or BP) and index register (SI or
DI), the resulting value is a pointer to location where
data resides
Data Transfer Instructions
Data Transfer Instructions
Arithmetic Instructions
Arithmetic Instructions
Number Representation
Logical Instructions
String Instructions
Program Transfer Instructions
Program Transfer Instructions
Processor Control Instructions
Assembler Directives
 Assembler directives give instruction to the
assembler where as other instructions discussed in
the above section give instruction to the 8086
microprocessor
 Assembler directives are specific for a particular
assembler
 However all the popular assemblers like the Intel
8086 macro assembler, the turbo assembler and the
IBM macro assembler use common assembler
directives
Important Directives
 The ASSUME directive tell the assembler the name of the logical
segment it should use for a specified segment
 The DB directive is used to declare a byte-type variable or to set
aside one or more storage locations of type byte in memory
(Define Byte)
 The DD directive is used to declare a variable of type doubleword
or to reserve memory locations which can be accessed as type
doubleword (Define Doubleword)
 The DQ directive is used to tell the assembler to declare a
variable 4 words in length or to reverse 4 words of storage in
memory (Define Quadword)
Important Directives
 The ENDS directive is used with the name of
a segment to indicate the end of that logical
segment
 The EQU is used to give a name to some
value or symbol
Assembly Language Program
 Writing assembly language programs for 8086 is
slightly different from that of writing assembly
language programs for 8085
 In addition to the instructions that are meant for
solving the problem, some additional instructions are
required to complete the programs
 The purpose of these additional programs is to
initialize various parts of the system, such as
segment registers, flags and programmable port
devices
 Some of the instructions are to handle the stack of
the 8086 based system
Assembly Language Program
 Another purpose of these additional instructions is to
handle the programmable peripheral devices such
as ports, timers and controllers
 The programmable peripheral interfaces should be
assigned suitable control words to make them to
function in the way as we expect
 The best way to approach the initialization task is to
make a checklist of all the registers, programmable
devices and flags in the system we are working on
Assembly Language Program
 An 8086 assembly language program has
five columns namely
 Address
 Data or code
 Labels
 Mmnemonics
 Operands
 Comments
Assembly Language Program
 The address column is used for the address
or the offset of a code byte or a data byte
 The actual code bytes or data bytes are put
in the data or code column
 A label is a name which represents an
address referred to in a jump or call
instruction
 Labels are put in the labels column

S-ar putea să vă placă și