Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Microprocessors
Lecture 1
Evolution of Computers
First generation (1939-1954)
vacuum tube
Second generation (1954-1959) transistor
Third generation (1959-1971) - IC
Fourth generation (1971-present) microprocessor
Evolution of Computers
First generation (1939-1954) - vacuum
tube
Vacuum Tube
Vacuum Tubes is a device that relies on the flow
of electric current through a vacuum. Vacuum
tubes may be used for rectification,
amplification, switching, or similar processing or
creation of electrical signals.
Timing
Reset
Control logic
Program
counter
Instruction
decoder
ALU
Reg.
I/O
Refresh
logic
System bus
Introduction to Assembly
Language:
CPU can only work in binary
It can do so at very high speed
Program that consist of 0s and 1s is called machine
language.
The process of working in machine language was
still cumbersome for humans.
Therefore assembly languages were developed
which provided mnemonics for the machine code
instructions, plus other features that made
programing faster
Contd. . .
Assembly language program must be translated
into machine code by a program called assembler.
Assembly language is referred to as a low
language
Because it deals directly with the internal structure
of the CPU.
To program in assembly language you must know
the number of registers and their size and other
details of the CPU
Exec 1
Fetch 2
Exec 2
Exec 1
Fetch 2
Exec 2
Fetch 3
Exec 3
Introduction to 8086
8086 Features
16-bit Arithmetic Logic Unit
16-bit data bus
20-bit address bus
8086 Architecture
The 8086 has two parts, the Bus Interface Unit
(BIU) and the Execution Unit (EU).
The BIU fetches instructions, reads and writes
data, and computes the 20-bit address.
The EU decodes and executes the instructions
using the 16-bit ALU.
The BIU contains the following registers:
Contd. . .
IP - the Instruction Pointer
CS - the Code Segment Register
DS - the Data Segment Register
SS - the Stack Segment Register
ES - the Extra Segment Register
Contd. . .
The BIU fetches instructions using the CS and IP,
written CS:IP, to construct the 20-bit address.
Data is fetched using a segment register (usually
the DS) and an effective address (EA) computed
by the EU depending on the addressing mode.
Registers
15
Data Group
Pointer and
Index Group
8 7
AX
AH
AL
Accumulator
BX
BH
BL
Base
CX
CH
CL
Counter
DX
DH
DL
Data
SP
Stack Pointer
BP
Base Pointer
SI
Source Index
DI
Destination Index
8086 Architecture
The EU contains the following 16bit registers:
AX - the Accumulator
BX - the Base Register
CX - the Count Register
DX - the Data Register
Contd. . .
SP - the Stack Pointer
BP - the Base Pointer
SI - the Source Index Register
DI - the Destination Register
These are referred to as generalpurpose registers, although, as seen by
their names, they often have a specialpurpose use for some instructions.
Contd. . .
The AX, BX, CX, and DX registers
can be considered as two 8-bit
registers, a High byte and a Low
byte. This allows byte operations
and compatibility with the previous
generation of 8-bit processors, the
8080 and 8085. The 8-bit registers
are:
Contd. . .
AX --> AH,AL
BX --> BH,BL
CX --> CH,CL
DX --> DH,DL
Flag Bits
Bit 0 - CF Carry Flag - Set by carry out of
msb
Bit 2 - PF Parity Flag - Set if result has even
parity
Bit 4 - AF Auxiliary Flag - for BCD arithmetic
Bit 6 - ZF Zero Flag - Set if result is zero
Bit 7 - SF Sign Flag = msb of result
Bit 8 - TF Single Step Trap Flag
Bit 9 - IF Interrupt Enable Flag
Bit 10 - DF String Instruction Direction Flag
Bit 11 - OF Overflow Flag
Bits 1, 3, 5, 12-15 are undefined.
AH
AL
BH
BL
CH
CL
ES
DH
DL
SS
BP
DI
CS
DS
IP
SI
SP
Address
generation and
bus control
operands
ALU
flags
Instruction
queue
Internal Block Diagram of 8088/8086
BIU registers
CS
SS
DS
IP
AX
BX
CX
DX
EU registers
16 bit arithmetic
AH
BH
CH
DH
SP
BP
SI
DI
FLAGS
Code Segment
Stack Segment
Data Segment
Instruction Pointer
AL
BL
CL
DL
Accumulator
Base Register
Count Register
Data Register
Stack Pointer
Base Pointer
Source Index Register
Destination Index
Register
Segments
Segment Starting address is
segment register value shifted 4
place to the left.
MEMORY
Address
000000H
CODE
STACK
64K Data
Segment
DATA
CS:0
EXTRA
64K Code
Segment
0FFFFFH
4000H
CS: 0400H
IP
0056H
4056H
Left-shift 4
bits
0
0400
Segment Register
+ 0056
Offset
04056H
Physical or
Absolute Address
CS:IP = 400:56
Logical Address
Memory
0FFFFFH
DS:
05C0
EA 0050
Segment Register05C0 0
+ 0050
Offset
05C50H
Physical Address
05C00H
05C50H
DS:EA
Memory
0FFFFFH
Programming
MOV Instruction:
MOV instruction copies data from one location to
another
Syntax:
MOV destination , source
copy source operand to destination
More Examples
MOV CL,55H
Move 55H into register CL
MOV DL,CL
Copy the contents of CL into DL
(Now DL=CL=55H)
Other Examples
MOV
MOV
MOV
MOV
MOV
MOV
Ax,58CFH
DX,6678H
AH,6789H
AL,8FH
AX,45H
AX,687H