Wachemo University
Institute of Technology
Department of Computer Science
Course Title: Microprocessor & Assembly Language Programming
Chapter Two
BASIC ARCHITECTURE OF THE 8088 AND
8086 MICROPROCESSORS
By: Tseganesh M.(MSc.)
Subscribe on Yadah Academy YouTube channel
Outline
2.1. Internal architecture of the 8086/8088 microprocessors
2.2. Memory address space and data organization
2.3. Data types
Registers in 8086/8088 microprocessors
2.4. Segment registers and memory segmentation
2.5. Pointer and index register
2.6. Status and flag register
2.7. The Stack
Overview
• Objective of the chapter to:
• Understand the internal architecture of the 8086/8088 microprocessors.
• Explore memory organization, data types, registers, flags, and the stack.
• As we discuss in previous chapter.
A Microprocessor: is a programmable electronics chip that has computing and decision
making capabilities similar to CPU of a computer.
Any microprocessor-based systems having limited number of resources are called
microcomputers.
Nowadays, microprocessor can be seen in almost all types of electronics devices
like mobile phones, printers, washing machines etc.
Microprocessors are also used in advanced applications like radars, satellites and
flights.
WCU-CS Compiled by TM. 3
Overview cont’d…
What is the similarity between Microprocessor and Registers?
Microprocessor
A microprocessor is a multipurpose, clock-driven digital integrated circuit that contains
registers, an ALU, and control unit.
It accepts binary data as input, processes it, and provides binary results as output.
Microprocessors are the most common type of computer processor and are designed to be
reliable by combining all the components of a CPU into a single circuit.
Registers
Registers are a type of computer memory/storage space found inside a microprocessor and
used to transfer data to the CPU for processing.
They are used to store and manipulate data, such as instructions, storage addresses, bit
sequences, or individual characters.
Registers is a part of the microprocessor and used for arithmetic operations, bitwise
operations, and other operations.
The size of a register can be 8, 16, 32, or 64 bits.
WCU-CS Compiled by TM.
Accessing registers is much faster than accessing RAM 4
Overview cont’d…
What is the difference between 8086 Microprocessor and 8086 Registers?
8086 microprocessor
The 8086 microprocessor is a 16-bit register-based processor.
A 16-bit microprocessor that can process 16-bit data at a time.
The 8086 has a 20-bit external address bus that provides a 1 MiB physical address space.
8086 registers
The 8086 registers are a set of 16-bit registers that are part of the microprocessor.
The 8086 microprocessor has 14 16-bit registers that are accessible to the programmer.
Eight of these registers are general-purpose registers that can be used for data
manipulation, arithmetic, and logic operations.
Each general purpose register is divided into two 8-bit subparts, one high and one low.
WCU-CS Compiled by TM.
5
Overview cont’d…
Before, we proceed to the detail discussion on 8086/8088 microprocessors, let’s understand
the following common terms
Bit: is a single binary digit.
Word: refers to the basic data or bit size that can be processed by the ALU of the processor.
For instance; in a 16-bit processor, a 16-bit binary number is called a word.
Bus: is a group of wires/lines that carry similar information.
System Bus: is a group of wires/lines used for communication b/n the microprocessor & peripherals.
Memory Word: is a number of bits that can be stored in a register or memory element.
Address Bus: It carries the address, used to identify a memory location or an I/O port.
For e.g., an 8bit address bus has eight lines and thus it can address 𝟐𝟖 = 256 different locations.
The locations in hexadecimal format can be written as 00H – FFH.
Data Bus: is used to transfer data b/n memory and processor or b/n I/O device and processor.
For example, a 16-bit processor will have 16-bit data bus.
Control Bus: carry control signals, used for selection of memory or I/O device from the given
address, direction of data transfer and synchronization of data transfer in case of slow devices. 6
WCU-CS Compiled by TM.
2.1. Internal architecture of the 8086/8088 microprocessors
Overview of the 8086/8088 microprocessors:
Key Features:
The 8086/8088 are 16-bit microprocessors, supports segmented memory architecture.
Executes complex instructions using its instruction set (CISC).
Commonly used in early personal computers (e.g., IBM PCs).
Key Components: 8086/8088 microprocessors have the same registers, ALU, and instruction set,
ALU (Arithmetic Logic Unit): Performs arithmetic and logic operations.
Registers: Stores temporary data and instructions.
Instruction set: Pre-fetches instructions for faster execution.
Key Registers:
General-purpose registers (AX, BX, CX, DX).
Segment registers (CS, DS, ES, SS).
Instruction Pointer (IP). WCU-CS Compiled by TM. 7
2.1. Internal architecture of the 8086/8088 microprocessors
Major Components of Internal architecture includes:
Bus Interface Unit (BIU) & Execution Unit (EU):
i. Bus Interface Unit (BIU):
Handles communication with memory and I/O devices via the System Bus.
Performs instruction fetching (memory read or I/O read), address calculation,
and data transfer between memory and I/O devices.
BIU mainly contains the 4 Segment registers, the Instruction Pointer, a pre-fetch
queue, and an Address Generation Circuit.
ii. Execution Unit (EU):
Decodes & Executes instructions, and performs arithmetic/ logic operations.
Contains Arithmetic Logic Unit (ALU), registers, and control logic (Instruction Decoder)
Performing by Fetching instructions from the Queue in BIU, decodes, and executes AL
operations using the ALU. 8
WCU-CS Compiled by TM.
Internal architecture of the 8086/8088 cont’d…
Execution Unit (EU):
Then, Sends control signals for internal
data transfer operations within Control Unit
Sends request signals to the BIU to access
the external module.
It operates with respect to T-states (clock
cycles) and not machine cycles.
Difference between 8086 and 8088:
Intel 8086 (introduced in 1978): 16-bit processor and has a 16-bit data bus with a 20-bit
address bus, while.
Intel 8088: has 8-bit external data bus, compatible with simpler hardware. 9
WCU-CS Compiled by TM.
2.2. Memory address space and data organization
Memory Addressing/Address space:
The 8086/8088 can address up to 1 MB of memory (20-bit address bus).
Memory is divided into 16 segments, each 64 KB.
Data Organization:
In 8086/8088 data organized as bytes (8 bits) or words (16 bits).
Addresses are byte-addressable, meaning each memory location holds 1 byte.
E.g.; A word (16 bits) stored at address 1000H is will occupy across two
consecutive memory locations:
1000H (low byte) and
1001H (high byte).
WCU-CS Compiled by TM.
10
2.3. Data Types
Supported Data Types:
Unsigned integers (8-bit, 16-bit).
Byte (8 bits): Smallest addressable unit.
Word (16 bits): Two consecutive bytes.
Signed integers (two's complement).
Doubleword (32 bits): Four consecutive bytes.
BCD (Binary Coded Decimal) numbers.
ASCII characters.
Example:
Data A5H is a byte.
Byte: 8-bit data (e.g., 10101010 in binary).
Word: 16-bit data (e.g., 0010101010101010 in binary). 11
Registers and Memory Segmentation in 8086/8088 microprocessors
The 8086 microprocessor is one of the family of 8086, 80286, 80386, 80486,
Pentium, PentiumI, II, III …. also referred to as the X86 family.
The 8086/8088 microprocessors have several types(approximately 14-registers)
each of 16-bit registers, including:
General purpose registers: These include AX, BX, CX, DX, SP, BP, SI, and DI.
Segment registers: These are 16 bits wide and include CS, DS, ES, and SS.
Pointers and index registers: These registers are used for pointers and
indexing.
Flag or status register: This register contains flags.
Initially, we will use four of the general purpose registers: AX, BX, CX, DX
These four 16-bit registers can also be treated as eight 8-bit registers: AH, AL, BH,
BL, CH, CL, DH, DL 12
WCU-CS Compiled by TM.
2.4. Segment Registers and Memory Segmentation
Purpose of Segment Registers
Segment registers in the 8086/8088 microprocessors are used to divide the memory into
manageable segments
It provide a way to address a larger memory space efficiently within the limitations of a
16-bit processor.
Each segment register holds the starting address of a specific segment in memory.
Key Functions of Segment Registers:
a. Memory Segmentation:
Segment registers allow the 8086/8088 to access a 1 MB memory space by combining a
segment address (stored in a segment register) with a 16-bit offset address.
a. Efficient Memory Access:
Segmentation enables the processor to access data and instructions without having to
manage the full 20-bit memory address directly.
1.Organized Memory Usage: WCU-CS Compiled by TM. 13
Segment Registers and Memory Segmentation cont’d…
c. Organized Memory Usage:
Different segments separate instructions, data, and the stack, ensuring clear
organization and improved performance.
d. Flexibility:
Allows dynamic memory allocation, where segments can be relocated without
affecting the rest of the program.
Types of Segment Registers:
Code Segment (CS): Stores the address of executable instructions, All programs are
stored in the CS and accessed via the IP.
Data Segment (DS): Stores data used in programs.
Stack Segment (SS): Stores stack-related data.
Extra Segment (ES): Used for additional data storage.
14
WCU-CS Compiled by TM.
Segment Registers and Memory Segmentation cont’d…
Memory Segmentation:
In order to increase execution speed and fetching speed, 8086 segments/divides memory
into segments, thus improve organization and efficiency.
This approach makes addressing simpler and more efficient for programmers and the
processor.
Logical address = Segment Address
Address = (Segment × 16) + Offset.
E.g.: If CS = 2000H and IP = 0050H,
Then effective physical address is calculated as:
Address=(CS×16)+IP
=(2000𝐻×10𝐻)+0050𝐻
=20050𝐻.
Exercise: Calculate the physical address for the logical address=3000H and IP= 0100H.
15
WCU-CS Compiled by TM.
2.5. Pointer and Index Registers
Pointer Registers:
Instruction Pointer (IP): Points to the next instruction in the code segment.
Stack Pointer (SP): Points to the top of the stack in the stack segment.
Base Pointer (BP): Used for accessing parameters in the stack.
Index Registers:
Source Index (SI) and Destination Index (DI): Used for string operations and
memory indexing.
Example:
MOV AX, [SI]: Moves data from the address pointed by SI to AX.
WCU-CS Compiled by TM. 16
2.6. Status and Flag Register
Purpose: Indicates the status of the processor and results of operations.
Flags:
Status Flags:
Zero Flag (ZF): Set if the result of an operation is zero.
Sign Flag (SF): Indicates the sign of the result (1 for negative, 0 for positive).
Carry Flag (CF): Indicates if there is a carry/borrow in arithmetic operations.
Overflow Flag (OF): Indicates arithmetic overflow.
Parity Flag (PF): Indicates even/odd parity of the result.
Control Flags:
Interrupt Flag (IF): Enables or disables interrupts.
Direction Flag (DF): Determines the direction of string operations.
Example: After an addition operation, CF is set if the result exceeds 16 bits. 17
2.7. The Stack
Definition:
A stack is a region of memory used for temporary storage of data, especially during
function calls and interrupts.
Stack Operations:
PUSH: Adds data to the top of the stack.
POP: Removes data from the top of the stack.
E.g.:
PUSH AX: Saves the value of AX on the stack.
POP BX: Retrieves the top value from the stack into BX.
Stack Pointer (SP): Points to the current top of the stack in the stack segment (SS).
WCU-CS Compiled by TM.
18
Summary
The 8086/8088 microprocessors have a segmented memory model with specialized registers
for efficient data handling.
Flags and the stack enable advanced functionality like conditional execution and nested calls.
Sub-topic Example
Internal Architecture BIU fetches instruction, EU executes it.
Memory Address Space Effective address = Segment × 16 + Offset.
Data Types BCD: 25 (decimal) = 00100101 (binary).
Segment Registers CS = 1000H, Offset = 0002H, → Address = 10002H.
Pointer & Index Registers SI points to array base, DI points to destination.
Flags ZF = 1 if result is zero
Stack PUSH AX, value of AX stored on the stack.
WCU-CS Compiled by TM.
19
Next class
Chapter 03: ADDRESSING MODES
3.1. Data-Addressing Modes
3.2. Program Memory-Addressing Modes
3.3. Stack Memory-Addressing Modes
Outline Chapter 04: INSTRUCTIONS
4.1. Data Movement Instructions
4.2. Arithmetic and Logic instructions
ANY
QUESTION ?
11/17/2024 WCU-CS Compiled by TM. 21