Microprocessor & Assembly Language
Microprocessor & Assembly Language
Microprocessor & Assembly Language
Language
Abrham Debasu (Assistant professor)
What is Microprocessor ?
Intel 4004/4040
Intel 4004/4040
Early microprocessors
Intel 4004/4040
Intel 4004/4040
Intel 8086/8088
Intel 80286
Advanced microprocessors
Intel 80386
Intel 80486
Pentium, i3, i5, i7…
Why do we study 8086?
GPRs
Segment registers
Can be used for arithmetic and logic operations and data movement
GPRs can be used together (as register pair) to store 16-bit data
Pointers and Index Registers:
The Stack Pointer points at the current top value of the Stack
00000H
Segment Registers:
Code Segment (CS) Register: Containing address of all
executable instructions. The user cannot modify the content of
these registers.
Data Segment (DS) Register: Containing address of base location
for variables. The user can modify the content of the data
segment.
Stack Segment (SS) Registers: The SS is used to store the
information about the memory segment. The operations of the SS
are mainly Push and Pop.
Extra Segment (ES) Register: If there is less space in that
segment, then ES is used. ES is also used for copying purpose
Generation of 20-bit Address
SEG x 10 + OFFSET
Example
SEG x 10 + OFFSET
P.A of CS = CS x 10 + Offset
1111H x 10 = 11110H + 6721H
17831H
L.A = CS:IP
1111H:6721H
Flag Register
There are total 9 flags in 8086 and the flag register is divided into
two types:
A. Status Flags
B. Control Flags
Flag Register
Overflow Flag (OF)
Overflow Flag is set to 1 when there is a signed overflow. For example, when you
add bytes 100 + 50 (result is not in range -128…127).
AL BL
Rule
An immediate value can’t be a destination
Direct addressing mode
The offset value of the given data will be both base and index register
MOV AX, [BX + SI]
MOV CX, [BP + DI]
Example
MOV AX, [BX + SI]
BX= 0001H
BX= 0001H
SI= 12ABH
SI= 12ABH 12AC *10+1111H
DS= 1111H
Register relative addressing mode
Reading Assignment
Exercise
Consider AX = 1212h; BX= 1B1Bh; CX=2323h; DX=2C2Ch; SI= 0050h; DI = 0110h; SP= 23h; BP= 0100h;
DS=1010h
Calculate the effective address of the following instructions
What is an instruction?
An instruction is a binary patern designed inside a
microprocessor to perform a specific function
The entire group of instruction that a microprocessor
supprts is Instruction set