Professional Documents
Culture Documents
It is a 16 bit p.
8086 has a 20 bit address bus can access up to 220 memory locations (
1 MB) .
It can support up to 64K I/O ports.
It provides 14, 16-bit registers.
It has multiplexed address and data bus AD0- AD15 and A16 A19.
CISC Complex Instruction Set Computers
Pipelining
AX
16-bit register
Registers
Bits
16
8
16
16
16
Instruction
Flag
16
16
AH
8-bit reg.
AL
8-bit reg.
Register Names
AX, BX, CX, DX
AH, AL, BH, BL, CH, CL, DH, DL
SP (stack pointer), BP (base pointer)
SI (source index), DI (destination index)
CS (code segment), DS (data segment)
SS (stack segment), ES (extra segment)
IP (instruction pointer)
FR (flag register)
Anatomy of a Register
Extended Register
Word Register
Bits 16-31
Bits 8-15
Bits 0-7
General Registers
32 bit Registers
16 bit Registers
8 bit Registers
EAX
EBP
AX
BP
AH
AL
EBX
ESI
BX
SI
BH
BL
ECX
EDI
CX
DI
CH
CL
EDX
ESP
DX
SP
DH
DL
Bits 16-31
Bits 8-15
Bits 0-7
The 32-bit general-purpose registers EAX, EBX, ECX, EDX, ESI, EDI, EBP, and ESP
are provided for holding the following items: operands for logical and arithmetic
operations, operands for address calculations, and memory pointers.
Registers can be broken down into 16 and 8 bit registers.
We will use the notation (E)AX to refer to any of AL, AH, AX, or EAX.
Each of the lower two bytes of the EAX, EBX, ECX, and EDX registers can be
referenced by the names AH, BH, CH, and DH (high bytes) and AL, BL, CL, and DL
(low bytes).
The lower two bytes of the other registers EBP, ESI, EDI, and ESP can not be
referenced.
Many instructions assign specific registers to hold operands. For example, string
instructions use the contents of the ECX, ESI, and EDI registers as operands.
General Registers I
EAX Accumulator
accumulator for operands and results data
usually used to store the return value of a procedure
ECX Counter
counter for string and loop operations
General Registers II
ESI Source Index
source pointer for string operations
Segment Registers
CS Code Segment
contains the segment selector for the code segment where
the instructions being executed are stored
SS Stack Segment
contains the segment selector for the stack segment,
where the procedure stack is stored
Instruction Pointer
EIP
Instruction Pointer
Contains the offset within the code segment of the next instruction to be
executed
Cannot be accessed directly by software
Rule #3:
If a value less than FFH is moved into a 16-bit register, the rest of the
bits are assumed to be all zeros.
MOV BX, 5
BX =0005
BH = 00, BL = 05
Program Segments
A segment is an area of memory that includes up to 64K bytes
Program Segments
Code segment
The 8086 fetches the instructions (opcodes and operands) from the code segments.
Physical address
Offset address
A location within a 64KB segment range
A range of 0000H to FFFFH
Logical address
consist of a segment value and an offset address
Program Segmentsexample
Define the addresses for the 8086 when it fetches the instructions
(opcodes and operands) from the code segments.
Logical address:
Consist of a CS (code segment) and an IP (instruction pointer)
format is CS:IP
Offset address
IP contains the offset address
Physical address
generated by shifting the CS left one hex digit and then adding it to the IP
the resulting 20-bit address is called the physical address
Program Segmentsexample
Suppose we have:
CS
IP
2500
95F3
Logical address:
Consist of a CS (code segment) and an IP (instruction pointer)
format is CS:IP
2500:95F3H
Offset address
IP contains the offset address which is
95F3H
Physical address
generated by shifting the CS left one hex digit and then adding it to the IP
25000 + 95F3 = 2E5F3H
Program Segments
Data segment
Data segment refers to an area of memory set aside for data
Format DS:BX or DI or SI
example:
DS:0200 = 25
DS:0201 = 12
DS:0202 = 15
DS:0203 = 1F
DS:0204 = 2B
Program Segments
Data segment
Example:
Add 5 bytes of data: 25H, 12H, 15H, 1FH, 2BH
Not using data segment
MOV
ADD
ADD
ADD
ADD
ADD
AL,00H
AL,25H
AL,12H
AL,15H
AL,1FH
AL,2BH
;clear AL
;add 25H to AL
Program Segments
Data segment
Example:
Add 5 bytes of data: 25H, 12H, 15H, 1FH, 2BH
using data segment with a constant offset
Program:
MOV
ADD
ADD
ADD
ADD
ADD
AL,0
AL,[0200]
AL,[0201]
AL,[0202]
AL,[0203]
AL,[0204]