Professional Documents
Culture Documents
Fourth Generation
During 1980s
Low power version of HMOS technology
(HCMOS)
Third Generation 32 bit processors
During 1978 Physical memory space 224 bytes = 16 Mb
HMOS technology ⇒ Faster speed, Virtual memory space 240 bytes = 1 Tb
Higher Floating point hardware
packing density Supports increased number of addressing
16 bit processors ⇒ 40/ 48/ 64 modes
pins
Easier to program Intel 80386
Dynamically relatable programs
Processor has multiply/ divide arithmetic
hardware
Second Generation
More powerful interrupt
During 1973
handling
Intel 8086 (16 bit capabilities
processor) NMOS technology ⇒ Faster speed, Higher
density, Compatible with TTL
Flexible I/O port
4 / 8/ 16 bit processors ⇒ 40 pins
addressing
First Generation Ability to address large memory spaces
and I/O ports
Between 1971 – 1973
Greater number of levels of subroutine
PMOS technology, non compatible with
nesting
TTL
Better interrupt handling capabilities
4 bit processors ⇒ 16
pins
Intel 8085 (8 bit processor)
8 and 16 bit processors ⇒ 40 pins
• What is Microcomputer?
• What is Microprocessor?
Functional blocks
Various conditions of the
Computational Unit;
results are stored as
performs arithmetic and Internal storage of data
status bits called flags in
logic operations
flag register
Overview
First 16- bit processor released
by INTEL in the year 1978
Address/Data bus
Pins and
Common signals
MN/ MX
MINIMUM / MAXIMUM
Pins and
Common signals
Signals
READY
Pins and
Common signals
RESET (Input)
Signals Causes the processor to
immediately terminate its present
activity.
Pins and
Signals
Pins and
Signals
Pins and
Signals
8086 Microprocessor
Maximum mode signals
Features of 8086
Microprocessor
• 8086 is a 16 bit μp
• 8086 has 16 bit Data Bus(D0-D15).
• 8086 has 20 bit Address Bus(A0-A19).
• 8086 has multiplexed Address and Data bus which
reduced the number of pins (AD0-AD15) & (A16-
A19).
• The memory addressing capacity is 1 MB.
• 8086 requires only one power supply +5V and one
clock phase whose frequency can be up to 5MHz.
• 8086 has 40 pin dual in line package.
• 8086 has 14, 16 bit registers.
8086 Microprocessor
Architecture
Architecture 20 bit
Dedicated Adder toaddress
generate
Architecture
Segment
Registers
Architecture
Segment Code Segment Register
•16-bit
Registers
•CS contains the base or start of the current code segment; IP contains
the distance or offset from this address to the next instruction byte to be
fetched.
•That is, all instructions of a program are relative to the contents of the CS
register multiplied by 16 and then offset is added provided by the IP.
8086 Microprocessor
Bus Interface Unit (BIU)
Architecture
Segment Data Segment Register
Registers
•16-bit
•Points to the current data segment; operands for most instructions are
fetched from this segment.
•The 16-bit contents of the Source Index (SI) or Destination Index (DI) or a
16-bit displacement are used as offset for computing the 20-bit physical
address.
8086 Microprocessor
Bus Interface Unit (BIU)
Architecture
Segment Stack Segment Register
•16-bit
Registers
•Points to the current stack.
•The 20-bit physical stack address is calculated from the Stack Segment
(SS) and the Stack Pointer (SP) for stack instructions such as PUSH and
POP.
Architecture
Segment Extra Segment Register
Registers
•16-bit
•Points to the extra segment in which data (in excess of 64K pointed to by
the DS) is stored.
Architecture
Segment Instruction Pointer
•16-bit
Registers
• Always points to the next instruction to be executed within
the currently executing code segment.
Architecture
Instruction queue
• A group of First-In-First-Out
(FIFO) in which up to 6 bytes
of instruction code are pre
fetched from the memory
ahead of time.
A decoder in the EU
control system
translates instructions.
and
Some of the 16 bit registers can be
Index registers (Source used as two 8 bit registers as :
Index, Destination Index)
each of 16-bits AX can be used as AH and AL
BX can be used as BH and BL
CX can be used as CH and CL
DX can be used as DH and
8086 Microprocessor
Execution Unit (EU)
Architecture
EU Accumulator Register (AX)
Registers
• Consistsof two 8-bit registers AL and AH, which can
be combined together and used as a 16-bit register AX.
• AL in this case contains the low order byte of the word, and
AH contains the high-order byte.
Architecture
EU Base Register (BX)
Registers
• Consistsof two 8-bit registers BL and BH, which can
be combined together and used as a 16-bit register BX.
Architecture
EU Counter Register (CX)
Registers
• Consistsof two 8-bit registers CL and CH, which can
be combined together and used as a 16-bit register CX.
Example:
Architecture
EU
Registers
8086 Microprocessor
Execution Unit (EU)
Architecture
EU Stack Pointer (SP) and Base Pointer (BP)
Registers
• SP and BP are used to access data in the stack segment.
Architecture
EU Source Index (SI) and Destination Index (DI)
Registers
• Used in indexed addressing.
34
8086 Microprocessor
Execution Unit (EU)
Architecture
EU Source Index (SI) and Destination Index (DI)
Registers
• Used in indexed addressing.
Flag Register
Architecture Auxiliary Carry Flag
lowest nibble, i.e, bit three during This flag is set, when there is
addition, or borrow for the lowest a carry out of MSB in case of
nibble, i.e, bit three, during addition or a borrow in case
subtraction. of subtraction.
This flag is set, when the This flag is set, if the result of This flag is set to 1, if the lower
result of any computation the computation or comparison byte of the result contains even
is negative performed by an instruction is number of 1’s ; for odd number
zero of 1’s set to zero.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
OF DF IF TF SF ZF AF PF CF
Tarp Flag
Over flow Flag
If this flag is set, the processor
This flag is set, if an overflow occurs, i.e, if the result of a signed
enters the single step execution
operation is large enough to accommodate in a destination
mode by generating internal
register. The result is of more than 7-bits in size in case of 8-bit
signed operation and more than 15-bits in size in case of 16-bit interrupts after the execution of
sign operations, then the overflow will be set. each instruction
Direction Flag Interrupt Flag
This is used by string manipulation instructions. If this flag bit
is ‘0’, the string is processed beginning from the lowest Causes the 8086 to recognize
address to the highest address, i.e., auto incrementing mode. external mask interrupts; clearing IF
Otherwise, the string is processed from the highest address disables these interrupts.
towards the lowest address, i.e., auto incrementing mode. 36
8086 Microprocessor
Architecture
8086 registers
categorized 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
into 4 groups OF DF IF TF SF ZF AF PF CF
AX 16-bit Accumulator Stores the 16-bit results of arithmetic and logic operations
AL 8-bit Accumulator Stores the 8-bit results of arithmetic and logic operations
BX Base register Used to hold base value in base addressing mode to access
memory data
CX Count Register Used to hold the count value in SHIFT, ROTATE and LOOP
instructions
DX Data Register Used to hold data for multiplication and division operations
SP Stack Pointer Used to hold the offset address of top stack memory
BP Base Pointer Used to hold the base value in base addressing using SS
register to access data from stack memory
SI Source Index Used to hold index value of source operand (data) for string
instructions
DI Data Index Used to hold the index value of destination operand (data)
for string operations 38
Addressing Modes
1) Immediate addressing mode
2) Register addressing mode
3) Direct memory addressing mode
4) Register based indirect addressing mode
5) Register relative addressing mode
6) Base indexed addressing mode
7) Relative based indexed addressing mode
1) Immediate addressing mode
• In this mode, the operand is specified in
the
instruction itself.
• Example:
• MVI CL, 12H
• This instruction moves 12 immediately into
CL
register. CL ← 12H
2) Register addressing mode
• In this mode, operands are specified using
registers.
• Example:
• MOV AX, BX
• This instruction copies the contents of BX
register into AX register. AX ← BX
3) Direct memory addressing mode
• In this mode, address of the operand is directly specified in
the instruction. Here only the offset address is specified,
the segment being indicated
• Example:
• MOV CL, [4321H]
• This instruction moves data from location 4321H in the
data segment into CL.
• The physical address is calculated as
• DS * 10H + 4321
• Assume DS = 5000H
• ∴PA = 50000 + 4321 = 54321H
• ∴CL ← [54321H] by the instruction.
4) Register based indirect addressing
mode
• In this mode, the effective address of the memory
may be taken directly from one of the base
register or index register specified by
instruction.
• Example:
• MOV CX, [BX]
• This instruction moves a word from the address
pointed by BX and BX + 1 in data segment into
CL and CH respectively.
• Physical address can be calculated as DS *
10H + BX.
5) Register relative addressing mode
ADD CX,DI
ADC AX,
[BX] INC SP
ARITHMETIC INSTRUCTIONS
• SUBTRACT instruction
Examples
SUB AX, SP
SUB DH,6F
SBB AX,BX
DEC BH
ARITHMETIC INSTRUCTIONS
• MULTIPLICATION instructions
MUL CL
MUL CX
IMUL
CL
• DIVISION instructions
DIV CL
IDIV SI
LOGICAL INSTRUCTION
• AND instruction
Example
AND AL,BL
• OR instruction
Example
OR SI,DX
• XOR instruction
XOR CH,OE
• NOT instruction
NOT CH
Shift and Rotate Instruction
• SHL instruction
SHL AX,1
• SHR instruction
SHR AX,CL
• ROL instruction
ROL AX,1
• ROR instruction
ROR AX,CL
Jump Instruction
• Jump instruction are used to change the
execution path of instruction in the
program.
i) Unconditional Jump
Short Jump
Near Jump
Far Jump
ii)Conditional
Jump
String and String Handling
Instructions
• Move Operation: Move is a process of
moving a string of data from one Memory
Location to another.
Eg. MOVSB: This instruction moves a byte
of data from one memory location to
another.
MOVSW: This instruction moves a
word of data from Source to Destination
Operand.
String and String Handling
Instructions
• Compare Operation: Compare is a process of
comparing two elements in the same or
different string.
Eg. COMPSB: This instruction compares a
byte of data from one memory location to
another.
COMPSW: This instruction compares a
word of data from one memory location to
another.
String and String Handling
Instructions
• SCAN: SCAN is a process of comparing
elements of Destination string with
Accumulator.
Eg. SCASB: This instruction scans a byte of
data from Destination with Accumulator
Register.
SCASW: This instruction scans a
word of data from Destination with
Accumulator Register.
String and String Handling
Instructions
• Load Operation: Load is a process of
loading string elements from Memory
Location with Accumulator.
Eg. LODSB: This instruction loads a byte of
data from Memory Location with
Accumulator.
LODSW: This instruction lods a word
of data from Memory Location with
Accumulator.
String and String Handling
Instructions
• Store Operations: Store is a process of moving
string of elements from Accumulator to
Memory Location.
Eg.STOSB: This instruction stores a byte of
data from Accumulator to Memory Location.
STOSW: This instruction stores a word of
data from Accumulator to Memory Location.
String and String Handling
Instructions
• AUTO INDEXING: Auto Indexing is a
process of Incrementing or Decrementing the
content of Source Index or Destination Index.
Eg.CLD: When this instruction is executed
Direction Flag is cleared to zero. Now Auto
Incrementing Source Index or Destination
Index takes place.
Assembly Language
Programming
• 16 bit Addition
Assembly Language
Programming
Interrupt and Interrupt Service
Routing
• While CPU is executing a program, an
interrupt breaks the normal sequence of
executing the instruction, it diverts its
execution to some other program called
Interrupt Service Routine.
• After executing, the control is transferred back
again to the main program which was being
executed at the time of interrupt.
Interrupt and Interrupt Service
Routing
• 8086 has two types of interrupt pins NMI and INTR.
• NMI(Non Maskable Interrupt): It is a single non-
maskable interrupt pin (NMI) having higher priority
than the maskable interrupt request pin.
• The INTR is a maskable interrupt because the
microprocessor will be interrupted only if interrupts
are enabled using set interrupt flag instruction. It
should not be enabled using clear interrupt Flag
instruction.
Interrupt and Interrupt Service
Routing
• Types of Interrupt:
1.External Interrupt: External device or
a signal interrupt the process from
outside.
Eg. Keyboard
2.Internal Interrupt. Internal Interrupt is
Interrupt:
generated internally by the processor
circuit.
Eg. Overflow Interrupt.
Assembler Directives
• Assembler is a program which translates an
assembly language program into machine
language program.
1.ASSUME: The ASSUME directive is used to
tell the assembler that the name of the logical
segment should be used for a specified segment.
The 8086 works directly with only 4 physical
segments: a Code segment, a Data segment, a
Stack segment, and an Extra segment.
Assembler Directives
Eg.
ASSUME CS:CODE: This tells the assembler
that the logical segment named CODE contains
the instruction statements for the program and
should be treated as a code segment.
•Modular Programming
•Need of Modular Programming
•Why Modular Programming?
•Modularity
•Advantages of Modular Programming
•Disadvantages of Modular Programming
MODULAR PROGRAMMING
•We will assign a name to each module and combine the named
modules in a program structure under the control of a main program.
•When all modules are tested ‘OK’, they are linked together to form a
large functioning program.
1.Assembling Process
• As mentioned earlier, assembler translates a source file that was created
using the editor into machine language such as binary or object
code. The assembler reads the source file of our program from the disk
where we saved it after editing. An assembler usually reads our source file
more than once.
• The assembler generates two files on the floppy or hard disk during these
two passes. The first file is called the object file. The object file
contains the binary codes for the instructions. The second file generated by
the assembler is called assembler list file. This file contains the
assembly language statements, the binary code for each
instruction, and the offset for each instruction.
• In the first pass, the assembler performs the following operations
1.Assembling Process
• Reading the source program instructions.
• Creating a symbol table in which all
symbols used in
the program, together with their attributes, are
stored.
• Replacing all mnemonic codes by their binary
codes.
• Detecting any syntax errors in the
source program.
• Assigning relative addresses to
instructions
2.Linking Process