You are on page 1of 42

Microprocessors and

Microcontrollers
-Module 1Basheer V P
Asst. Professor
Department of Electronics and
Communication Engineering
A Ameen Engineering College

Module-1
 Software architecture of the INTEL
8086
 Address space & Data organization
 Memory segmentation and addressing
 Data Types
 Registers
 Stack
 I/O space
AAEC

Microprocessor &
Microcontroller

2

Software Model of the 8086
Microprocessors

• Purpose of developing the software model is
to aid the programmer in understanding the
operation of the microprocessor system
from a software point of view.
• To be able to program a processor,

– No need to know all of its hardware,
interconnections etc.
– But important to the programmer to know the
various registers and to know their purpose,
functions, operating capabilities and limitations.
AAEC

Microprocessor &
Microcontroller

3

Software Model of the 8086
Microprocessors

AAEC

Microprocessor &
Microcontroller

4

Software Model of the 8086Description ----For the detailed description of the different elements of the software architecture. refer the same note of hardware architecture.---- AAEC Microprocessor & Microcontroller 5 .

Memory segmentation and addressing • Need for Segmentation – – – – – ( • To implement Harvard architecture Easy to debug Same Interfacing ICs can be used To avoid overlap of stack with normal memory Compatible with 8085 for reference: Von – Newman architecture • Single pool of memory. no separate Program Memory & Data Memory. • Harvard architecture • Separate Program Memory & Data Memory.) AAEC Microprocessor & Microcontroller 6 .

Segmented Memory AAEC Microprocessor & Microcontroller 7 .

AAEC Microprocessor & Microcontroller 8 .

Four Segments AAEC Microprocessor & Microcontroller 9 .

AAEC Microprocessor & Microcontroller 10 .

AAEC Microprocessor & Microcontroller 11 .

Segment Registers & Offset Registers • 4 Segments in 8086 – Code Segment (CS) – Data Segment (DS)SEGMENT – Stack Segment (SS) – Extra Segment (ES) Code SEGMEN T REGISTE R Instruction Pointer (IP) DSR Source Index (SI) ESR Destination Index (DI) SSR Stack Pointer (SP) / Base 12 Segment Extra Segment Stack AAEC Microprocessor & Segment Microcontroller REGISTER CSR Segment Data OFFSET .Segments.

Segment : Offset Address • Logical Address is specified as segment:offset • Physical address is obtained by shifting the segment address 4 bits to the left and adding the offset address. • Thus the physical address of the logical address A4FB:4872 is: A4FB0 + 4872 A9822 AAEC Microprocessor & Microcontroller 13 .

Offset Value (16 bits) Segment Register (16 bits) 0000 Adder Physical Address (20 Bits) AAEC Microprocessor & Microcontroller 14 .Memory Address Generation • The BIU has a dedicated adder for determining physical memory addresses.

AAEC Microprocessor & Microcontroller 15 .

 Address space & Data organization Address space : The 8086 supports 1Mbyte of external memory The memory space is organized as individual bytes of data stored at consecutive addresses over the address range 0000016 to FFFFF16 (or 00000H to FFFFFH) Memory address sp AAEC Microprocessor & Microcontroller 16 .

• The lower-addressed byte is the least significant byte and the higheraddressed byte is the most significant byte Storing a word in memory AAEC Microprocessor & Microcontroller 17 .Data organization • 8086 can access any two consecutive bytes as a word of data.

– Also called aligned word • Odd address boundary:– A word at an odd address boundary corresponds to two consecutive bytes . with the least byte located at an odd address.Aligned and misaligned data word • Even address boundary:– A word at an even address boundary corresponds to two consecutive bytes . – Also called misaligned word AAEC Microprocessor & Microcontroller 18 . with the least byte located at an even address.

Aligned and misaligned data word AAEC Microprocessor & Microcontroller 19 .

Aligned and misaligned double words of data AAEC Microprocessor & Microcontroller 20 .

Storing double word in memory AAEC Microprocessor & Microcontroller 21 .

– Integer (Unsigned and Signed) – BCD (Unpacked and Packed) and – ASCII Codes. AAEC Microprocessor & Microcontroller 22 .Data Types • Different data types supported by 8086 are.

Data Types Unsigned byte integer 0 .535 AAEC Microprocessor & Microcontroller 23 .255 Unsigned word integer 0 – 65.

768 .+127 Signed integers -32.Data Types -128 .767 AAEC Microprocessor & Microcontroller 24 .+32.

Data Types Unpacked BCD Binary Coded Decimal (BCD) Packed BCD AAEC Microprocessor & Microcontroller 25 .

American Standard Code for Information Interchange (ASCII) AAEC Microprocessor & Microcontroller 26 .

the 8086 automatically PUSHes the current value of CS and IP onto the stack. • Other registers can also be pushed • Before return from the subroutine. • When a CALL is executed. POP instructions can be used to pop values back from the stack into the corresponding registers. AAEC Microprocessor & Microcontroller 27 .The Stack • The stack is used for temporary storage of information such as data or addresses.

• The address obtained from the contents of SS and SP (SS:SP) is the physical address of the last storage location in the stack to which data were pushed. This memory address is known as top of the stack. the value in SP is initialized to FFFE.The Stack • SP contains an offset value that points to a location in the current stack segment. AAEC Microprocessor & Microcontroller 28 . • At the start up.that is the bottom of the stack. Combining this value with the current value in SS gives the highest addressed word location in the stack (SS:FFFE).

AAEC Microprocessor & Microcontroller 29 . • Each time a word is to be pushed on to the stack. • During the pop operation.The Stack • Data transferred to and from the stack are word wide not byte wide. SP is decremented by 2. the co tents are first popped off to the register and then SP is automatically incremented by 2. and then contents of the register are written in to the stack.

The Stack AAEC Microprocessor & Microcontroller 30 .

Example for PUSH AAEC Microprocessor & Microcontroller 31 .

Example for POP AAEC Microprocessor & Microcontroller 32 .

• The rest of the locations can be used by the user.The I/O address space • 8086 has separate memory and I/O address spaces. • I/O address space is from 0000 to FFFF (64K). • Therefore I/O addresses are 16 bits long. AAEC Microprocessor & Microcontroller 33 . • The I/O address space is the place where I/O interfaces such as printer etc are implemented. • Eight locations from 00F8 to 00FF are reserved by Intel Corporation.

The I/O address space AAEC Microprocessor & Microcontroller 34 .

AAEC Microprocessor & Microcontroller 35 .

AAEC Microprocessor & Microcontroller 36 .

AAEC Microprocessor & Microcontroller 37 .

AAEC Microprocessor & Microcontroller 38 .

AAEC Microprocessor & Microcontroller 39 .

AAEC Microprocessor & Microcontroller 40 .

AAEC Microprocessor & Microcontroller 41 .

AAEC Microprocessor & Microcontroller 42 .