Professional Documents
Culture Documents
ASSEMBLY LANGUAGE
LECTURE-3-THE 80X86
MICROPROCESSOR
MUHAMMAD HAFEEZ
DEPARTMENT OF COMPUTER SCIENCE
GC UNIVERSITY LAHORE
TODAY’S AGENDA
History of Computer
Intel Microprocessors
HISTORY OF COMPUTERS
Zeroth Generation (1642-1945) - Mechanical
Blaise Pascal – Four Function Calculator
Charles Babbage – Difference Engine and
Analytical Engine
AX, BX, CX, DX and their High / Low parts are used in
8086
SEGMENT REGISTERS TO
ADDRESS SEGMENTED
MEMORY
A Typical assembly language program has
four segments in memory
Code Segment
Data Segment
Stack Segment
Extra Segment
SEGMENTED MEMORY
8085 predecessor of 8086 had 64K
addressable memory, 216 memory
locations, 16 address lines
8086 has 1MB addressable memory, 220
memory locations, 20 address lines
For compatibility reason memory in 8086 is
segmented in 64K segments, each assigned to
Code Segment, Data Segment, Stack Segment
and Extra Segment
Therefore, a program in 8086 can handle at
maximum of 64K Stack Segment, 64K Data
Segment, 64K Code Segment and 64K Extra
Segment.
Segment starts at every 10H=16 bytes,
called paragraph, an address divisible by 16
called a paragraph boundary
LOGICAL ADDRESSES AND
PHYSICAL ADDRESSES
Three types of addresses
Physical Address
Logical Address
Offset Address
Physical Address:
A 20-bit address to address 1MB memory
Range from 00000H to FFFFFH
Offset Address:
A 16-bit address to address 64KB memory
Range from 0000H to FFFFH
Used to address memory within 64K segment
CODE SEGMENT
Logical Address for Code Segment:
Consist of Logical Address using IP Register as
Offset referred to as CS:IP
Physical Address of Code segment:
CS shifted 1 Hex and add IP, result is 20-bit
address
Physical Address Calculation Example:
CS = 2500H, IP= 95F3H
Logical Address CS:IP, 2500:95F3
Physical Address
25000H
95F3H
2E5F3H (Physical 20-bit address)
DATA SEGMENT
Assume, use memory to Add 5 bytes of
data, 25H, 15H, 05H, 25H, 15H
To take each byte for addition, each time data is
referred
The need to set aside an area for data segment
arose
Just like CS:IP for code segment, Data Segment
has an offset stored in register
Example:
DS:0200 = 25H
DS:0201= 15H
DS:0202= 05H
DS:0203=25H
DS:0204=15H
DATA SEGMENT
It is more convenient to store offset
address of data segment in register
In 8086 BX, SI and DI are used as offset register
for data segment
STACK SEGMENT
Used to hold the values stored in Stack
during program execution
EXTRA SEGMENT
This segment is used if the program spans
beyond 64K for Code or Data Segment, i.e.
we have to use two segments for a
program
POINTERS AND INDEX
REGISTERS
Pointers and Index Registers points to
memory location (offset address)
Can be used in arithmetic and other operations
Stack Pointer (SP):
Used in conjunction with Stack Segment (SS) to
point to Stack area in memory
Base Pointer (BP):
Primarily used with Stack Segment (SS) to
access area of stack, however, can be used to
access other areas of memory with other
segments
Source Index (SI):
SI is used to access memory area in Data
Segment (DS), increment SI to access
consecutive memory locations
POINTERS AND INDEX
REGISTERS
Destination Index (DI):
Work same way as SI, string instructions use DI
CS IP
SS SP, BP
DS BX, SI, DI
??????????????????????????