The 80x86 Microprocessor: Dara Rahmati
The 80x86 Microprocessor: Dara Rahmati
The 80x86 Microprocessor: Dara Rahmati
Single-bus Structure
kolan yek bus vase ertebatat dare
peroformance kamtar
tedad pine kamtar vali
Address Bus
IO device
CPU RAM ROM I/O ports
IO device
Data Bus
Control Bus
I/O bus
CPU
Memory I/O ports I/O ports I/O ports
bus
Memory
IO device IO device IO device
• A dedicated bus between CPU and memory, and a dedicated bus between CPU
and I/O devices
• pro:efficient in terms of data transfer
• con:information between memory and I/O devices has to go through CPU.
Therefore, poor CPU performance
Memory-mapped I/O
ye decoder k msln bge az 0 ta 500 vase MEM age 500 ta 1000 bud vase IO
yani ba hamun mechanismi k ba memory dar ertebatim ba hamun ba io dar ertebatim
Address
Address Memory
ye rah ine k 2 seri bus asln dashte bashim mitune hm moshtarak bashe ama ye pin baraye choose krdn dashte bashim
MA address
Address Memory address Memory
chosen
CPU CPU
• Isolated I/O
– Two separate address spaces for memory and I/O
modules mamulan ba shomare port kar mikone
The general registers can be accessed as the full l6 bits (such as AX), or as
the high byte only (AH) or low byte only (AL).
• High-level languages (like C) are translated into machine code by a program called a
compiler
e.g. using a C compiler to translate the program into machine language.
• There are many assemblers available for translating 80x86 Assembly language
programs into machine code. One of the most commonly used assemblers, DEBUG
(Appendix A), MASM by Microsoft, others TASM, NASM, FASM, …
Max Segment size 64KB 8085 can address a max of 64K bytes
• This limitation was carried into the design of the 8088/86 to
ensure compatibility with 8085
• 8088/86 can only handle a maximum of 64K bytes of code and
64K bytes of data and 64K bytes of stack at any given time
How to move this window of 64K bytes to cover all 1 megabyte of
memory in 8088/86!?
address
un addressi k tu barname nevisi estefade mishe >> zoje moratabi az segment address o offset
Microprocessors and Assembly 24
Code Segment, Logical Address
4bit seg / 16 bit offset ye raheshe ama chon nmikhastan knare ham bashan hatman segment ha vase hamin azin rah estefade nkrdn
MOV AL,00H ;initialize AL In this program, the data and code are
;add 25H to AL mixed together in the instructions.
ADD AL,25H
ADD AL,12H ;add 12H to AL the idea arose to set aside an area of
ADD AL,15H ;add 15H to AL memory strictly for data
ADD AL,1FH ;add 1FH to AL
This area is called Data Segment
ADD AL,2BH ;add 2BH to AL Like code segment we have:
DS:offset
Example: 5000:1950
Physical: 50000 + 1950 = 51950
mitunim bjaye faghat code segment ye Data Segment dashte bashim k dade ha untu bashe va intori addresse dade ha b dast miad va komak mikone b segmentation k un khavaso
dasht
Microprocessors and Assembly 30
Rewriting the Program
Using Data Segment
Assume that the offset for the data segment begins at 200H.
The data is placed in memory locations:
DS:0200 = 25
DS:0201 = 12
DS:0202 = 15
DS:0203 = 1F
DS:0204 = 26
Why BX? The 8086/88 allows only the use of registers BX, SI,
and DI as offset registers for the data segment.
the low byte goes to the low memory location and the high
byte goes to the high memory address
DS:1500 = F3 and DS:1501 = 35 >> little endian
This convention is called little endian versus big endian.
Little Endian: All Intel microprocessors and many others like A Gulliver’s Travels story
VAX from DEC (Digital Equipment Corporation), most of about how an egg should be
AVR microcontrollers. opened: from the little end
or the big end
Big Endian: IBM's mainframes, most RISC-based computers,
and Motorola microprocessors. TCP/IP (thus big-endian is
sometimes called network order)
ARM?
Supports both Little and Big endian and it is left to the 33
implementer Microprocessors and Assembly
end