Microprocesser and Assembly Language Assignment
Microprocesser and Assembly Language Assignment
Group Assignment
1
Various instruction of8086 and how 8086 work 3
comparing 8085,8086,8088 32
1
1.List various Instructions of 8086 and write how
Introduction
The 8086 microprocessor, a key player in the development of modern computing,
features a rich set of instructions that facilitate a wide range of operations. These
instructions can be categorized into various groups, including data transfer,
arithmetic, bit manipulation, processor control, Iteration control, interrupt and
string manipulation instructions. Each category serves a specific purpose, allowing
programmers to efficiently manage data and execute complex tasks.
This article will explore the various instructions of the 8086 microprocessor in
detail, examining their functionality and providing insights into how they
contribute to the overall performance of computing systems.
2
Data Transfer Instructions
These instructions are used to transfer the data from the source operand to the
destination operand. Following are the list of instructions under this group
LEA − Used to load the address of operand into the provided register.
LDS − Used to load DS register and other provided register from the memory
LES − Used to load ES register and other provided register from the memory.
Instructions to transfer flag registers
LAHF − Used to load AH with the low byte of the flag register.
SAHF − Used to store AH register to low byte of the flag register.
PUSHF − Used to copy the flag register at the top of the stack.
POPF − Used to copy a word at the top of the stack to the flag register.
Arithmetic Instructions
3
These instructions are used to perform arithmetic operations like addition,
subtraction, multiplication, division, etc.Following is the list of instructions under
this group
4
Bit Manipulation Instructions
These instructions are used to perform operations where data bits are involved,
i.e. operations like logical, shift, etc.Following is the list of instructions under this
group
5
String Instructions
CALL − Used to call a procedure and save their return address to the stack.
RET − Used to return from the procedure to the main program.
JMP − Used to jump to the provided address to proceed to the next instruction.
6
JA/JNBE − Used to jump if above/not below/equal instruction satisfies.
JAE/JNB − Used to jump if above/not below instruction satisfies.
JBE/JNA − Used to jump if below/equal/ not above instruction satisfies.
JC − Used to jump if carry flag CF = 1
JE/JZ − Used to jump if equal/zero flag ZF = 1
JG/JNLE − Used to jump if greater/not less than/equal instruction satisfies.
JGE/JNL − Used to jump if greater than/equal/not less than instruction satisfies.
JL/JNGE − Used to jump if less than/not greater than/equal instruction satisfies.
JLE/JNG − Used to jump if less than/equal/if not greater than instruction satisfies.
JNC − Used to jump if no carry flag (CF = 0)
JNE/JNZ − Used to jump if not equal/zero flag ZF = 0
JNO − Used to jump if no overflow flag OF = 0
JNP/JPO − Used to jump if not parity/parity odd PF = 0
JNS − Used to jump if not sign SF = 0
JO − Used to jump if overflow flag OF = 1
JP/JPE − Used to jump if parity/parity even PF = 1
JS − Used to jump if sign flag SF = 1
These instructions are used to execute the given instructions for number of times.
Following is the list of instructions under this group
LOOP −Used to loop a group of instructions until the condition satisfies, i.e.,CX = 0
7
LOOPE/LOOPZ − Used to loop a group of instructions till it satisfies ZF = 1 & CX = 0
LOOPNE/LOOPNZ -Used to loop a group of instructions till it satisfies ZF=0&CX = 0
JCXZ − Used to jump to the provided address if CX = 0
Interrupt Instructions
These instructions are used to call the interrupt during program execution.
INT − Used to interrupt the program during execution and calling service specified.
INTO − Used to interrupt the program during execution if OF = 1
IRET − Used to return from interrupt service to the main program
Conclusion
The Intel 8086 microprocessor's instruction set is a fundamental aspect of its
architecture, enabling a wide range of operations essential for programming and
system control. By categorizing instructions into different instructions and the
8086 provides a versatile toolkit for developers. Each category of instructions
plays a crucial role in managing data flow, performing calculations, manipulating
bits, and controlling program execution. For instance, data transfer instructions
facilitate seamless movement of information between various components of the
system, while arithmetic instructions allow for complex mathematical operations.
Bit manipulation instructions enable efficient data processing at the binary level,
which is critical for optimizing performance. Understanding these instructions
empowers programmers to write efficient assembly language code and leverage
the full capabilities of the 8086 microprocessor. As a cornerstone of early
computing technology, the 8086 not only paved the way for subsequent
processors in the x86 family but also established foundational principles that
continue to influence modern computing architecture.
Introduction
8
Control instructions in the Intel 8086 microprocessor are essential for managing
the flow of execution within a program. These instructions allow programmers to
alter the sequence of instruction execution based on specific conditions or events,
enabling the implementation of complex logic and control structures. By utilizing
these instructions, developers can create loops, conditional branches, and
procedure calls, which are fundamental to structured programming. The 8086
architecture provides a variety of control instructions that can be categorized into
several types, including unconditional jumps, conditional jumps, procedure calls,
and processor control instructions. Each type serves a distinct purpose and plays a
critical role in program execution. Understanding these control instructions is vital
for anyone working with assembly language or seeking to grasp the intricacies of
computer architecture. Control instructions are particularly important because
they enable dynamic program behavior. For example, they allow a program to
make decisions based on user input or the results of previous computations. This
adaptability is crucial for developing efficient software that can handle various
tasks and respond to different scenarios.
9
• JA/JNBE (Jump if Above/Not Below or Equal): Jumps if the previous
comparison indicates that one value is greater than another.
• JAE/JNB (Jump if Above or Equal/Not Below): Jumps if the previous
comparison indicates that one value is greater than or equal to another.
• JBE/JNA (Jump if Below or Equal/Not Above): Jumps if the previous
comparison indicates that one value is less than or equal to another.
• JC (Jump if Carry): Jumps if the carry flag (CF) is set.
• JE/JZ (Jump if Equal/Zero): Jumps if the zero flag (ZF) is set, indicating
equality.
• JG/JNLE (Jump if Greater/Not Less Than or Equal): Jumps if the
previous comparison indicates that one value is greater than another.
• JGE/JNL (Jump if Greater or Equal/Not Less Than): Jumps if the
previous comparison indicates that one value is greater than or equal to another.
• JL/JNGE (Jump if Less Than/Not Greater Than or Equal): Jumps if the
previous comparison indicates that one value is less than another.
• JLE/JNG (Jump if Less Than or Equal/Not Greater): Jumps if the
previous comparison indicates that one value is less than or equal to another.
10
• Example: LOOP LABEL will loop back to LABEL until CX = 0.
• LOOPE/LOOPZ: Loops while CX is not zero and ZF = 1 (zero flag).
• LOOPNE/LOOPNZ: Loops while CX is not zero and ZF = 0.
• JCXZ: Jumps to a specified address if CX = 0.
Conclusion
Control instructions in the Intel 8086 microprocessor are essential for managing
program execution flow. They enable developers to implement complex decision-
making processes through conditional branching and looping constructs. By
understanding how these instructions function—ranging from unconditional
jumps and procedure calls to conditional transfers based on processor flags—
programmers can create efficient and effective assembly language programs.
These control instructions not only enhance program logic but also allow for
better resource management within computing systems. As such, mastering these
instructions is essential for anyone looking to work closely with low-level
programming or computer architecture, providing a strong foundation for
understanding more advanced concepts in modern computing system.
Introduction
The 8086 microprocessor, released by Intel in 1978, revolutionized the world of
computing with its powerful performance and versatile capabilities. One of the
key components that contributed to its success was its addressing modes, which
allowed for efficient and flexible handling of memory operations. Addressing
modes refer to the methods used by a processor to access data or operands from
various memory locations. In this essay, we will explore the various addressing
modes implemented in the 8086 microprocessor and how they contribute to its
efficient functioning. Understanding these addressing modes is crucial for
programmers and developers in optimizing their code and harnessing the full
11
potential of this groundbreaking microprocessor. So let us delve into the world of
8086 addressing modes and unravel their significance in the realm of computing.
The 8086 is a widely used microprocessor that forms the basis of many computer
systems today. One of its key features is its ability to access and manipulate data
in different ways through addressing modes. These addressing modes allow the
processor to retrieve data from various sources, such as memory or registers, and
perform operations on them. In this essay, we will delve into the various
addressing modes of the 8086 and understand how they contribute to the
versatility and efficiency of this processor. By the end of this discourse, you will
have a comprehensive understanding of how these addressing modes work and
their significance in enhancing the capabilities of the 8086 microprocessor. So let
us dive in and explore the world of addressing modes in 8086.
The 8086 microprocessor employs various addressing modes that dictate how the
operands of instructions are specified and accessed. Understanding these modes
is crucial for efficient assembly language programming, as they affect how data is
retrieved and manipulated in memory.
12
memory address from which data will be retrieved or to which data will be
written, allowing for quick and straightforward access.
13
access, as the operand's address can be dynamically determined based on the
current value of the register plus an offset specified in the instruction.
Example: MOV AX, 50H[BX] (where BX provides the base and 50H is the
displacement).
Usage: Provides flexibility for accessing elements in data structures with offsets.
Conclusion
The addressing modes of the 8086 microprocessor are crucial for determining
how data is accessed and manipulated within instructions, significantly impacting
14
program efficiency and flexibility. By utilizing various modes such as immediate,
direct, register, and indexed addressing, programmers can optimize their code for
performance, allowing for faster data retrieval and manipulation. Each mode
serves a specific purpose, enabling efficient handling of operands whether they
are constants, memory addresses, or stored in registers. Understanding these
addressing modes is essential for effective assembly language programming and
leveraging the full capabilities of the 8086 architecture.
Introduction
The Intel 8086 microprocessor and the 8087 coprocessor represent significant
advancements in computing technology, each serving distinct yet complementary
roles within a computer system. The 8086 is a general-purpose 16-bit
microprocessor designed to handle a wide array of computing tasks, including
integer arithmetic and control operations. In contrast, the 8087 is a specialized
floating-point coprocessor that enhances the capabilities of the 8086 by
performing complex arithmetic operations involving real numbers. This distinction
allows for improved performance in applications requiring extensive
mathematical computations. Understanding the differences between these two
processors is crucial for grasping their respective functionalities and contributions
to early computing architectures, as well as their impact on software
development and system design.
15
The Intel 8087 is a floating-point coprocessor designed to work alongside the
8086 and 8088 microprocessors, introduced by Intel in 1980. Its primary function
is to accelerate floating-point arithmetic operations, including addition,
subtraction, multiplication, division, and square root, as well as transcendental
functions such as trigonometric and logarithmic calculations. The 8087
significantly enhances performance, achieving speed improvements ranging from
approximately 20% to over 500% compared to software-based calculations. It
operates using a modified stack architecture and features an instruction set that
includes about 60 specialized commands, identifiable by the prefix 'F' for floating-
point operations. This coprocessor allows for concurrent execution of instructions,
enabling the main CPU to perform integer operations while the 8087 handles
floating-point calculations, thereby improving overall system throughput.
The Intel 8087 coprocessor can be classified based on its functionality and the
types of data it processes. Here are the main classifications:
16
These classifications highlight the 8087's role in enhancing computational
capabilities, particularly in scientific and engineering applications, by providing
dedicated support for complex numeric calculations
The differences between the Intel 8086 microprocessor and the 8087
and the 8087microprocessors .
17
Instruction Set - Contains a general - Introduces additional
instruction set for various instructions specifically for
operations, including floating-point arithmetic, which
integer arithmetic. are not available in the 8086
instruction set
Conclusion
The differences between the Intel 8086 microprocessor and the 8087 coprocessor
highlight their distinct roles in a computing system. The 8086 serves as a general-
purpose microprocessor capable of handling a variety of tasks, including integer
arithmetic and control operations, while the 8087 is a specialized floating-point
coprocessor designed to accelerate complex mathematical calculations involving
real numbers. The 8086 operates independently, executing general instructions,
whereas the 8087 functions in tandem with the 8086, executing its own set of
floating-point instructions that enhance overall performance.The 8087
significantly improves the speed of floating-point arithmetic, achieving
performance enhancements that can be up to 100 times faster than software-
based calculations executed by the 8086. Additionally, the 8087 introduces a
dedicated instruction set for floating-point operations, which is not present in the
8086. Together, they enable more sophisticated computations, particularly
beneficial in scientific and engineering applications. Understanding these
differences is essential for grasping how these processors complement each other
to enhance computing capabilities.
Introduction
18
The 8086 microprocessor, a cornerstone of early computing, relies on a set of
control pins to manage its interactions with external devices and memory. Among
these, the READY, ALE (Address Latch Enable), HOLD, and RESET pins play crucial
roles in ensuring proper synchronization, data transfer, and system initialization.
These pins are not merely electrical connections; they are the communication
channels through which the 8086 coordinates its operations with the rest of the
system. Understanding the function of each of these pins is essential for anyone
working with or studying the 8086 architecture. This document will provide a
detailed explanation of the purpose and operation of the READY, ALE, HOLD, and
RESET pins, highlighting their significance in the overall functioning of the 8086
microprocessor.
Function
The READY pin (often also called RDY or WAIT) is an input signal on the 8086 used
to synchronize the microprocessor's operation with the speed of external devices,
primarily memory and I/O peripherals. It's a critical component of the 8086's
handshaking mechanism.
The 8086 can operate at a high clock speed, much faster than many external
components, especially older memory chips and peripherals. If the 8086 tries to
read data from a slow memory location before the data is actually available, or
tries to write data to a slow peripheral before it's ready to receive it, errors will
occur.
The READY pin addresses this by allowing slower devices to signal to the 8086
that they are not ready for a read or write operation.
19
Default State (High): Normally, the READY pin is held in a high state. This
indicates that the external devices are operating at a compatible speed, and the
8086 can proceed with read and write operations at its normal pace.
Slow Device (Low): When the 8086 initiates a memory or I/O cycle that targets a
slow device, the device (or an associated interface circuit) pulls the READY line
low.
Wait States Introduced A low signal on the READY input forces the 8086 into
wait states. During a wait state:
* The 8086 essentially pauses the current bus cycle.
* The CPU clock continues to run, but the internal state of the CPU remains
unchanged.
* The CPU effectively waits and does nothing except continue monitoring
the READY pin.
Device Ready (High Again): Once the slow device is ready (e.g., the memory
has retrieved the requested data, the peripheral has processed the command),
the device releases the READY line, allowing it to return to a high state.
Cycle Completion: The 8086 detects the high state on the READY pin and
completes the interrupted memory or I/O cycle.
Significance
The READY pin ensures that the 8086 can function correctly with a wide range of
devices that operate at different speeds. It avoids data corruption and timing
errors that would otherwise occur. Without it, the system would either need to
use only very fast peripherals or would be extremely unreliable.
Function
The ALE pin is an output signal that is critical for systems using the 8086 in
minimum mode, where the address and data buses are multiplexed (shared on
the same pins). ALE provides the crucial timing signal needed to separate
(demultiplex) the address from the address/data bus.
20
Multiplexed Address/Data Bus
• The 8086 in minimum mode uses the same pins (AD0-AD15) for both address
information during the first part of a bus cycle, and for data during the second
part of the cycle. This multiplexing saves pins on the chip itself, but it adds
complexity to external circuitry.
• Without a way to capture the address, it would be lost when the bus
switches to transmitting data.
Beginning of Cycle: At the beginning of a memory or I/O bus cycle, the 8086
places the 20-bit address onto the multiplexed address/data bus (AD0-AD15, and
address lines A16-A19). Simultaneously, the 8086 asserts the ALE signal (makes it
high).
ALE Pulse: The ALE signal is a short pulse. The rising edge of this pulse signals the
external address latches to capture and hold the current address available on the
bus.
Address Latched: External address latches (typically 74LS373 devices) are
connected to the AD0-AD15 pins, and their clock inputs are connec
Data Transmission: Once the address has been latched, the 8086 removes the
address from the AD0-AD15 pins and prepares to transfer data on the same lines.
The address, however, remains valid in the external latches, allowing memory or
peripherals to use it.
Significance
ALE enables the 8086 to share address and data lines efficiently, reducing the
overall pin count required for the chip, making it cost-effective, and reducing the
complexity of the system. Without ALE and external latches, the address
information would be lost.
Function
21
The HOLD pin is an input signal that allows external devices, particularly DMA
controllers, to request control of the system bus for high-speed data transfers
directly between memory and peripherals. The HOLD mechanism supports DMA
(Direct Memory Access).
DMA Request: When a DMA controller needs to access memory, it asserts the
HOLD pin high, effectively asking the 8086 for control of the bus.
Bus Release by 8086: Upon receiving the HOLD request:
* The 8086 completes the current memory or I/O bus cycle.
* The 8086 floats its address, data, and control lines (puts them into a high-
impedance state, effectively disconnecting them from the bus), giving the DMA
controller access.
* The 8086 asserts the HLDA (Hold Acknowledge) signal (an output pin on
the 8086) high. This HLDA signal indicates to the DMA controller that the bus is
available.
DMA Transfers: The DMA controller now takes control of the system bus, uses
the address, data, and control lines to perform direct transfers between memory
and the peripheral.
Bus Return: Once the DMA transfers are complete, the DMA controller releases
HOLD (makes it low).
8086 Regains Control: The 8086 detects the low state of HOLD, de-asserts the
HLDA pin, and regains control of the system bus and continues its tasks.
Significance
22
The HOLD/HLDA mechanism allows for high-speed data transfer, enabling more
efficient system operation by avoiding CPU intervention for large data
movements. Without this, DMA transfers wouldn't be possible, severely limiting
the system's performance.
Function
The RESET pin is an input signal that is used to initialize (reset) the 8086
microprocessor to a known starting state. It's an active-high signal.
• Asserting RESET (High): When the RESET pin is driven high (by an external
reset circuit), the 8086 immediately:
* Halts all ongoing operations.
* Clears the internal registers (including the program counter, flags, data
registers).
* Sets the program counter (PC) to a predefined memory address – typically
to 0xFFFF0 in the 8086 architecture (this is part of the top 16 bytes of the 1MB
memory space).
* Puts the output lines into a high-impedance state.
• Releasing RESET (Low): Once the RESET pin is released (goes low), the 8086
fetches the first instruction from the memory location pointed to by its reset
address.
Conclusion
23
The READY, ALE, HOLD, and RESET pins of the 8086 microprocessor are vital for its
proper operation and interaction with external components. The READY pin is
used for synchronizing the microprocessor with slower memory or peripheral
devices, ensuring that data transfers occur correctly. The ALE (Address Latch
Enable) pin is used to demultiplex the address and data lines, allowing the 8086 to
access memory and peripherals efficiently. The HOLD pin is used for direct
memory access (DMA) operations, allowing other devices to take control of the
system bus. Finally, the RESET pin is used to initialize the microprocessor and
bring it to a known starting state. Each of these pins plays a critical role in the
8086's ability to communicate with its environment, manage memory access, and
ensure proper system operation. This document will delve into the specifics of
each pin, explaining their functions and their importance in the overall
architecture of the 8086.
Introduction
The 80x86 family of central processing units (CPUs) represents a lineage of
microprocessors that have profoundly shaped the landscape of personal
computing. Beginning with the Intel 8086 in the late 1970s, this family has
evolved through numerous iterations, each introducing architectural
enhancements, increased processing power, and new capabilities. From the early
days of the IBM PC to modern high-performance computing, the 80x86
architecture has remained a dominant force. Understanding the history, evolution,
and key features of the 80x86 family is crucial for anyone studying computer
architecture, operating systems, or the history of computing. This document will
provide an overview of the 80x86 family, tracing its development from its origins
to its current state, highlighting the key innovations and milestones along the way.
24
I.The Genesis: The Intel 8086 (and 8088)
Significance
The 8086 was the first 16-bit microprocessor from Intel and a major leap from
their earlier 8-bit processors. It introduced the x86 instruction set architecture
(ISA) that has been the basis for all subsequent processors in this family.
Key Features
16-bit Architecture: 16-bit registers, 16-bit data bus, but 20-bit address bus
capable of accessing 1 MB of memory.
Segmented Memory Model: The 8086 used a segmented memory model with
16-bit segment registers (CS, DS, ES, SS) to access the full 1MB of address space.
This segmentation, while innovative at the time, led to some programming
complexities.
Instruction Set: The x86 instruction set included instructions for arithmetic,
logic, data movement, branching, and control.
8088 Variation: The 8088 was a slightly cheaper variant of the 8086 with an 8-
bit external data bus (though it maintained 16-bit internal processing). This
made it more compatible with existing 8-bit hardware. Famously used in the
original IBM PC.
Release: 1982
Significance
25
The 80286 (also known as the i286) was a significant upgrade, adding support
for a new "protected mode" of operation.
Key Features
• Real Mode: The 80286 could also operate in a "real mode" that emulated
the 8086, providing backwards compatibility.
• Impact: While the 80286 offered major advances, its protected mode wasn't
fully utilized until later with more advanced operating systems. The need to
switch between Real and Protected modes did cause some compatibility
problems.
Release: 1985
Significance
The 80386 (also known as the i386) was a revolutionary processor that moved
the x86 family into the 32-bit era.
Key Features
26
• 32-bit Architecture: Introduced 32-bit registers (EAX, EBX, ECX, EDX, ESI, EDI,
ESP, EBP) and a 32-bit data bus, significantly increasing processing power and
memory access.
• Flat 32-bit Memory Model: Protected mode was enhanced to support a 32-
bit flat memory model, allowing easier access to all of the memory and doing
away with segmentation. This greatly simplified programming.
• Paging: Added support for paging, an advanced virtual memory mechanism
that allowed the OS to use even more memory, beyond the physical RAM, as
well as offer greater memory protection and management capabilities.
• Virtual 8086 Mode: Introduced a "virtual 8086 mode," allowing multiple
8086 programs to run simultaneously in a protected manner under the OS.
• Clock Speeds: Around 16 MHz to 40 MHz.
• Impact: The 80386 marked a pivotal moment, making 32-bit software and
operating systems possible for the PC.
Release: 1989
Significance
The 80486 (also known as i486) improved upon the 80
Key Features
27
Release: 1993
Key Features
Significance
A major leap in performance, and a departure from numerical naming.
Release: 1995
Key Features
Deep pipelining, out-of-order execution, and a focus on performance for 32-bit
code.
Significance
Introduced a new microarchitecture, better handling of complex instructions.
• Pentium II and III (P6 Derivatives):
Release: 1997 (II) and 1999 (III)
Key Features
Integrated Level 2 cache, and Streaming SIMD Extensions (SSE) instruction sets
for multimedia processing.
Significance
Further refinement of the P6 architecture, increasing performance for
applications and multimedia content.
• Pentium 4 (NetBurst):
Release: 2000
Key Features
Increased clock speeds, a very long pipeline, and the SSE2, SSE3 instruction sets.
Significance
While initially promising, the NetBurst architecture eventually became
inefficient due to its deep pipeline, and was replaced with newer architecture.
28
VI. The Core Era (and Beyond): Multi-Core and Power
Efficiency
Key Features
Introduction of dual-core processors, significantly improved performance per
watt, and re-focus on power efficiency. These introduced the Core
microarchitecture which had a much shorter pipeline, which helped lower heat
output, and allowed the CPUs to perform more instructions.
Significance
Marked a shift towards multi-core CPUs as a way to increase performance and
efficiency by handling multiple tasks in parallel.
Key Features
Further improvements in power efficiency, integration of advanced graphics
capabilities, and introduction of hyperthreading technology. The i-series is now
the flagship architecture for desktop and laptop Intel processors, including the
i3, i5, i7, and i9 families, each targeted at different segments of the market.
Significance
The i-series maintains high performance, while addressing current performance
and efficiency demands.
• AMD's Contributions: While this focuses on Intel, AMD also made major
contributions, such as the Athlon and Ryzen processors, which compete with
Intel and have significantly shaped the landscape of x86 architecture.
29
• AMD's Innovation: AMD was the first to introduce the 64-bit extension to the
x86 architecture, called x86-64 (also known as AMD64). Intel later adopted this
and branded it as EM64T and then Intel 64.
• 64-bit Computing:
* Larger Address Space: 64-bit processors can access a massive 16 exabytes
(16 billion GB) of memory.
* Larger Registers: Introduced 64-bit registers (RAX, RBX, RCX, etc.), allowing
for faster processing of larger data sets.
*Enhanced Performance: The increased data width and address space
significantly enhanced the ability to run demanding software.
* Legacy Support: x86-64 processors maintained backwards compatibility with
32-bit x86 i
• Modern CPUs: Modern CPUs are far more complex, including features like:
• Multi-core processing.
• Hyperthreading.
• Advanced cache hierarchies (L1, L2, L3).
• Integrated graphics.
• Advanced power management techniques.
• Specialized instruction sets (AVX, AVX2, AVX-512).
Future
The 80x86 family of CPUs has come a long way from the original 8086. It has
consistently adapted to changing needs, constantly pushing the boundaries of
performance, and has maintained backwards compatibility while adopting new
technologies. Its long history and ongoing evolution makes it one of the most
influential and widespread processor families in the history of computing. From
the original IBM PC to the powerful servers of today, the x86 architecture has
left an indelible mark on the world.
30
Conclusion
The 80x86 family of CPUs is a diverse and influential group of microprocessors
that have shaped the personal computing industry. Starting with the 8086, a 16-
bit processor, the family expanded to include the 8088, a cost-effective variant,
and then progressed through the 80286, 80386, and 80486, each introducing
significant architectural improvements, such as protected mode and enhanced
memory management. The family then transitioned to the Pentium series, which
brought about further advancements in performance and multimedia capabilities.
The 80x86 architecture continued to evolve with the introduction of 64-bit
extensions, leading to the x86-64 architecture, which is now the standard for
most desktop and server CPUs. This document will explore the key features,
innovations, and historical significance of the major processors within the 80x86
family, providing a comprehensive overview of their evolution and impact on the
computing world.
Introduction
The 8085, 8086, and 8088 microprocessors represent significant milestones in the
evolution of computing technology. These chips, developed by Intel, played
pivotal roles in shaping the landscape of early personal computers and embedded
systems. While all three belong to the same family, they differ significantly in their
architecture, capabilities, and intended applications. This document provides a
comparative analysis of these three microprocessors, highlighting their key
features, differences, and historical significance. Understanding these differences
is crucial for appreciating the advancements in microprocessor technology and
their impact on the computing world.
31
Comparative Analysis of the 8085, 8086, and 8088
Microprocessors
• The 8085 is a true 8-bit microprocessor. This means it processes data in 8-bit
chunks, using an 8-bit data bus for data transfer.
• Its 16-bit address bus allows it to access 2^16 = 65,536 (64KB) memory
locations.
• Its instruction set is relatively simple, reflecting its design for basic control and
embedded applications.
• Its 20-bit address bus allows it to access 2^20 = 1,048,576 (1MB) memory
locations.
• Its instruction set is more powerful and complex than the 8085, enabling more
sophisticated operations.
32
• The 8086's architecture represents a significant advancement in processing
power and memory addressing capabilities.
• Its 20-bit address bus allows it to access 1MB of memory, similar to the 8086.
• The 8085's 16-bit address bus allows it to directly address 64KB of memory.
• It lacks memory segmentation, meaning that the entire 64KB memory space is
treated as a single contiguous block.
• This limitation restricts the size and complexity of programs that can be run on
the 8085.
33
• It introduced memory segmentation, dividing the 1MB memory space into
segments of 64KB each.
• This allows the 8086 to address more than 64KB of memory by using segment
registers (CS, DS, ES, SS) to specify the starting address of each segment.
• The 8088 shares the same 20-bit address bus and memory segmentation
scheme as the 8086, allowing it to access 1MB of memory.
• The 8088's memory management is identical to the 8086, despite its 8-bit
external data bus.
Capabilities
• The 8085 has a relatively simple instruction set, designed for basic control and
data manipulation tasks.
• Its instruction set is limited compared to the 8086 and 8088, reflecting its
design for simpler applications.
34
• The 8086 has a more powerful and complex instruction set than the 8085.
• Its instruction set is designed for more complex applications and provides
greater flexibility and efficiency.
• This means it can execute the same set of instructions as the 8086, providing
the same processing capabilities.
• The only difference is that the 8088 fetches data in 8-bit chunks due to its 8-
bit external data bus, which can impact performance.
• The 8085 was widely used in simple embedded systems, industrial control
applications, and early personal computers.
• Its simplicity, low cost, and low power consumption made it suitable for these
applications.
• The 8086 was used in early personal computers, including the IBM PC, and in
more complex industrial control systems.
35
• Its 16-bit architecture, larger memory addressing capabilities, and more
powerful instruction set made it suitable for these applications.
• The 8088 was used in the original IBM PC, which played a pivotal role in the
widespread adoption of personal computers.
• Its lower cost and compatibility with existing 8-bit systems made it a more
attractive option than the 8086.
• The 8088's success in the IBM PC cemented its place in the history of
computing.
Conclusion
The 8085, 8086, and 8088 microprocessors each occupied a unique niche in the
history of computing. The 8085, an 8-bit processor, was designed for simplicity
and low-cost applications, making it suitable for embedded systems and early
control applications. The 8086, a true 16-bit processor, offered a significant leap
in processing power and memory addressing capabilities, paving the way for more
complex applications and personal computers. The 8088, a cost-effective variant
of the 8086, utilized an 8-bit external data bus while retaining the 16-bit internal
architecture, making it more compatible with existing 8-bit systems and
36
contributing to the widespread adoption of the IBM PC. This document will delve
into the specifics of their architectures, instruction sets, memory management,
and applications, providing a comprehensive comparison of these three
influential microprocessors.
Introduction to Interrupts
In the realm of computer systems, efficiency and responsiveness are paramount.
A key mechanism that facilitates these qualities is the interrupt. An interrupt is
essentially a signal that temporarily suspends the normal execution of a program
or task to handle a more urgent event or request. Think of it as a way for the
computer to quickly switch its attention to something important without having
to continuously check if it needs to do so. This allows the computer to be both
responsive to real-time events and efficient in using its processing power.
Interrupts are categorized into two primary types: hardware interrupts, which are
triggered by external devices or hardware conditions, and software interrupts,
which are initiated by instructions within a program. Understanding these two
types, especially in the context of processors like the 8086, is fundamental to
understanding how computer systems operate at a low level.
Hardware Interrupts
37
Hardware interrupts are signals generated by external hardware devices, such as
peripherals, to notify the CPU of an event requiring attention. These events can
include:
• Timers: Regular pulses from a timer circuit, used for timekeeping or scheduling.
The 8086 has two dedicated pins for handling hardware interrupts:
• Pin: The NMI is signaled on the dedicated NMI pin of the 8086 processor.
• Purpose: This interrupt is designed for high-priority, critical events that the
CPU must respond to immediately. These events usually signal a serious or
catastrophic system condition.
• Examples:
38
• Masking: The key feature of NMI is that it cannot be masked by software. This
means that the interrupt flag (IF) in the 8086's flag register has no effect on it.
When an NMI signal is received, the CPU will interrupt its current operation
regardless of the value of the IF. This ensures that critical system issues are
addressed.
• Vector: The 8086 always uses interrupt type number 2 for NMI, corresponding
to the memory location where its ISR address is stored (0000:0008h). When the
NMI is triggered, the CPU saves the current code address (CS:IP) and flag register
on the stack, and jumps to the address specified at memory location 0000:0008h
to execute the NMI interrupt service routine (ISR).
• Pin: The INTR signal is received on the INTR pin of the 8086.
• Examples:
* Disk I/O: When a disk controller finishes transferring data, it triggers an INTR.
* Network Data Arrival: When data arrives over a network connection, the
network card sends an INTR.
* Printer Ready: When a printer becomes ready to receive data, it can trigger
an INTR.
39
• Masking: Maskable interrupts can be enabled or disabled by software, using
the interrupt flag (IF) in the 8086's flag register.
* When the IF is set to 1 (using STI instruction – set interrupt flag), the 8086
will acknowledge INTR signals (if the 8086 is not already processing higher-priority
interrupt).
* When IF is reset to 0 (using CLI instruction – clear interrupt flag), the 8086
ignores INTR signals (or defer processing them). This mechanism provides
flexibility and control over how the CPU responds to peripheral devices. The CPU
may defer an INTR if it’s executing a critical section of code.
• Interrupt Vector: When the 8086 acknowledges the INTR signal, it interacts
with the external interrupt controller, asking for the interrupt type number. The
PIC provides an 8-bit interrupt type number (0-255). Based on this number, the
8086 locates the corresponding ISR address from its interrupt vector table in
memory.
Software Interrupts
• Purpose: For requesting services from the OS, such as I/O (reading a key,
printing to the screen), memory management, or system-level operations.
40
• Masking: Software interrupts cannot be masked (disabled) with the IF flag, but
are still a part of system programming.
• ISR Address: Like hardware interrupts, software interrupts also use the
interrupt vector table to find the appropriate ISR address based on the interrupt
type specified in the instruction
• Examples:
• INT 0: Divide by Zero Error. This interrupt is automatically generated when the
CPU attempts to divide by zero. This provides a way for programs or the operating
system to detect and handle this error.
• INT 2: Non-Maskable Interrupt (NMI). This is the same as the hardware NMI,
but triggered by a INT 2 instruction.
41
• INT 10h (16 decimal): BIOS video services. Provides functions for displaying
characters and graphics. Common BIOS function for video display manipulation
(for example, set display mode, position the cursor, write characters).
• INT 16h (22 decimal): BIOS keyboard services. Provides functions for reading
keyboard input. Common BIOS function for handling keyboard input (for example,
read keypresses from keyboard buffer).
• INT 21h (33 decimal): DOS function calls. This interrupt provides access to DOS
system calls for various functions, including:
* Console I/O: Displaying output to the screen and reading input from the
keyboard.
• INT 20h: Program Terminate. Terminates the current program and transfers
control to DOS.
• Vector: Software interrupts also use the same interrupt vector table as
hardware interrupts to find the address of their corresponding ISRs.
• Masking: Software interrupts cannot be masked by the Interrupt Flag (IF) like
hardware INTR. When an INT n instruction is encountered, the CPU will
immediately save the current context and jump to the corresponding ISR.
Both hardware and software interrupts use the interrupt vector table (IVT). This is
a table located in the lower memory addresses of the 8086 system (starting at
address 00000h). The table holds 256 4-byte entries (total 1024 bytes), where
each entry contains:
42
• Address of the ISR: Each entry stores a 32-bit address for its interrupt handler
which contains the code segment (CS) and the instruction pointer (IP) for the
appropriate interrupt service routine (ISR).
The type number n in the INT n instruction, or the interrupt type supplied by the
external PIC for the INTR pin, is multiplied by 4 (as every entry takes 4 bytes). This
will give the offset within the IVT that contains the address of ISR for this
interrupt number.
3. Flag and Context Save: The 8086 saves the current program's context by
pushing the flag register, code segment (CS), and instruction pointer (IP) onto the
stack.
4. Vector Table Lookup: Based on the interrupt type (provided by the interrupt
controller or specified in the INT instruction), the 8086 retrieves the address of
the appropriate ISR from the interrupt vector table in the memory. The interrupt
vector table is a table that contains the addresses of ISR for each interrupt type.
6. ISR Service: The ISR handles the specific event that triggered the interrupt (e.g.,
a key press, data transfer complete, system call).
7. Context Restoration: When the ISR is done, it restores the original program's
context by popping the IP, CS, and flags from the stack.
43
8. Resumption: The CPU returns to where it was interrupted by the ISR with the
IRET instruction, and program execution resumes.
Conclusion
Interrupts are a core concept in computer architecture and operating systems.
They provide an essential mechanism for responsiveness, efficiency, and handling
asynchronous events in a real-time system. Hardware interrupts respond to
signals from external devices while software interrupts are used for system calls.
In the 8086, hardware interrupts are managed through the NMI and INTR lines.
Software interrupts, initiated by INT instructions, provide access to system-level
functionalities by interacting with the operating system's services. Understanding
interrupts is crucial for anyone working with embedded systems, operating
system development, or low-level programming. They are a vital part of any
computer system's ability to respond effectively to events.
example
Introduction
Directives in assembly language programming are essential tools that guide the
assembler in interpreting and processing the source code. Unlike executable
instructions that the CPU directly executes, directives serve as commands for the
assembler, providing crucial information about data allocation, code organization,
and overall program structure. Understanding the various purposes of directives
is fundamental for effective microprocessor programming, enabling developers to
write clear, efficient, and maintainable code.
44
1. Defining Data: Directives are primarily used to define and allocate memory for
variables and constants. The .data directive is commonly employed to declare
initialized data.
Example:
.data
In this example, the db (define byte) directive allocates space for a string and
initializes it with "Hello, World!" followed by a null terminator. The variable
count is also defined as a byte with an initial value of 10.
2. Organizing Code Segments: Directives help structure the code into segments,
which is essential for maintaining organized programs. The .text directive
indicates the beginning of the code segment where executable instructions reside.
Example:
.text
start:
The .text directive marks the beginning of the executable code segment. The
instructions following it are part of the program's main logic.
3. Controlling the Assembly Process: Some directives control how the assembler
processes the source code. For instance, the .include directive allows
programmers to incorporate external files containing additional definitions or
routines.
45
Example:
Example:
.ifdef DEBUG
.endif
5. Reserving Memory Space: Directives such as .bss are used to reserve space in
memory for variables that are not initialized. This is particularly useful for
allocating buffers or arrays.
Example:
.bss
This example reserves 128 bytes of uninitialized memory for buffer, which can
later be used to store data during program execution.
46
6. Defining Constants: The .equ directive allows programmers to define constants
that can be used throughout the program, improving readability and
maintainability.
Example:
7. Aligning Data: The .align directive is used to align data in memory at specified
boundaries, which can improve access speed and ensure proper data structure
alignment.
Example:
.data
This example ensures that the subsequent data (in this case, an array) starts at
a memory address that is a multiple of 4 bytes.
Conclusion
Directives play a crucial role in assembly language programming by providing
structure and control over how source code is assembled into machine language.
They facilitate data definition, code organization, memory management,
conditional assembly, and more, ultimately leading to clearer and more efficient
programs. By understanding and effectively utilizing these directives—such as
defining data, organizing code segments, controlling assembly processes,
implementing conditional compilation, reserving memory space, defining
constants, and aligning data—programmers can create high-quality assembly
47
code that meets the needs of microprocessor architecture. Mastery of directives
not only enhances coding efficiency but also contributes significantly to effective
low-level programming practices in embedded systems and performance-critical
applications.
Introduction
In computer architecture and assembly language programming, operand
instructions are fundamental components that dictate how data is manipulated.
Operand instructions can be categorized into two primary types: immediate
operand instructions and indirect operand instructions.
48
Both immediate and indirect operand instructions play crucial roles in
programming and system design, influencing performance, efficiency, and the
overall capability of computing systems. Understanding these types of
instructions helps programmers optimize their code and utilize hardware
resources effectively.
In this example, the immediate operand is the value 5. This value is directly
specified in the instruction, and the operation is performed using this value.
Immediate operand instructions are typically used for simple operations that
involve fixed values. They are also often used in situations where the value is not
known at the time the instruction is executed, but is known to the processor.
49
Indirect operand instructions are a type of instruction in computer programming
that use a memory address as the operand for the operation. This address points
to a location in memory where the actual data can be found.
``ADD 0x100```
In this example, the indirect operand is the memory address 0x100. This
address points to a location in memory where the actual data can be found.
The processor then retrieves the data from this location and performs the
operation using it.
Indirect operand instructions are typically used for more complex operations that
involve larger amounts of data or data that is not known at the time the
instruction is executed. They are also useful in situations where the data is stored
in a location that is not easily accessible or is not known at the time the
instruction is executed.
Indirect operand instructions work by specifying the operation and the memory
address in the instruction itself. The processor then retrieves the data from the
specified memory location and performs the operation using it.
50
1. Operand source: Immediate operand instructions use a constant value as the
operand, while indirect operand instructions use a memory address as the
operand.
by using table
51
Data Access Accesses data Accesses data stored in
immediately available in memory, which may
the instruction require additional
memory access.
52
Register Usage Typically does not use Often involves registers to
registers for the operand hold addresses, which can
itself (the value is lead to more register
embedded usage in programs
Storage Efficiency Less efficient for large More efficient for large
datasets since each datasets as it can
instruction carries its own reference a single address
data. that points to multiple
data items.
53
values are explicitly debug due to the
stated in the code. indirection; errors may
arise from incorrect
addresses rather than
values.
These differences highlight the distinct roles that immediate and indirect operand
instructions play in assembly language programming and computer architecture.
conclusion
On the other hand, indirect operand instructions provide greater flexibility and
are well-suited for accessing dynamic data structures and larger data types. They
allow for more complex addressing modes, enabling programmers to manipulate
data in a more versatile manner. However, this flexibility comes at the cost of
54
increased complexity in instruction decoding, potential security vulnerabilities,
and a greater demand for register usage.
mechanisms work?
a)Pass by value
b)Pass by reference
c) Pass by value-returned
d) Pass by name
Introduction
Parameter passing is a fundamental concept in programming that determines
how data is transferred between a calling function (or method) and a called
55
function. The mechanism used for parameter passing significantly impacts how
changes made to parameters within the called function affect the original data in
the calling function. Understanding these mechanisms is crucial for writing correct
and efficient code. This document will explore four common parameter passing
mechanisms: pass by value, pass by reference, pass by value-returned, and pass
by name, detailing how each works and their implications for program behavior.
A. Pass by value
Concept:
• In pass by value, a copy of the actual argument's value is made and passed to
the formal parameter of the called function.
• The called function works with this copy, not the original variable.
Mechanism:
1. When a function is called, the value of each actual argument is copied into the
corresponding formal parameter.
2. The formal parameter becomes a local variable within the called function.
3. Any changes made to the formal parameter within the function do not affect
the original variable in the calling function.
Analogy:
• Imagine you have a photo (the original variable). You make a photocopy of it
(the copy). You can write on the photocopy, but the original photo remains
unchanged.
• Example (Python):
def modify_value(x):
x = x + 10
56
print("Inside function:", x)
a=5
modify_value(a)
print("Outside function:", a)
Output
Inside function: 15
Outside function: 5
Advantages:
• Protects the original data from accidental modification within the function.
Disadvantages:
• Changes made within the function do not affect the original variable.
B. Pass by Reference
Concept:
• The called function works directly with the original variable through this
reference.
Mechanism:
57
1. When a function is called, the address of each actual argument is passed to
the corresponding formal parameter.
3. Any changes made to the formal parameter within the function directly affect
the original variable in the calling function.
Analogy:
• Imagine you have a house (the original variable). You give someone the
address of the house (the reference). They can go to the house and make changes
to it directly.
Example (C++):
#include <iostream>
x = x + 10;
int main() {
int a = 5;
modify_reference(a);
return 0;
Output:
Inside function: 15
58
Outside function: 15
Advantages:
Disadvantages:
• Can lead to unintended side effects if the function modifies the original
variable unexpectedly.
C. Pass by Value-Returned
Concept:
• However, unlike pass by value, the function can modify this copy, and the
modified copy is then explicitly returned to the calling function.
Mechanism:
59
2. Local Modification: The formal parameter becomes a local variable within the
called function. Any changes made to this local variable do not directly affect the
original variable in the calling function.
3. Returning the Modified Value: The function may modify the local copy and
then uses a return statement to send the modified value back to the calling
function.
4. Assignment: The calling function receives this returned value and can assign it
to the original variable or another variable. This assignment is what effectively
updates the original data.
Analogy:
• Imagine you have a document (the original variable). You make a photocopy of
it. You edit the photocopy and then give the edited photocopy back to the original
owner. The original document is only updated if the owner chooses to replace it
with the edited copy.
• Example (C++)
#include <iostream>
int modify_value_returned(int x) {
x = x + 10;
return x;
int main() {
int a = 5;
60
return 0;
Output:
Inside function: 15
Outside function: 15
Advantages:
• Provides a controlled way to modify data. The original variable is only updated
if the returned value is explicitly assigned back to it.
• Protects the original data from accidental modification within the function,
unless the returned value is used to update it.
• Can be more efficient than pass by value for large data structures when only a
modified copy is needed.
Disadvantages:
• Can be less efficient than pass by reference if the function needs to modify the
original variable directly and frequently.
• The calling function must remember to assign the returned value to update
the original variable.
D.Pass by Name
Concept:
61
• Pass by name (also known as call by name) is a more advanced and less
common mechanism where the actual argument is not evaluated until it is
actually used within the function.
Mechanism:
3. Multiple Evaluations: This evaluation can occur multiple times, and each time,
it may produce a different result if the argument involves variables that change
within the calling function.
Analogy:
• Imagine you have a recipe that says "add the number of apples in the basket."
You don't count the apples until you actually need to add them. If someone adds
or removes apples from the basket before you add them, the number you use will
change.
function modify_name(x) {
62
a = 5;
Advantages:
Disadvantages:
• Can lead to unexpected side effects if the argument involves variables that
change within the calling function.
• Use Cases:
63
Conclusion
Parameter passing mechanisms dictate how arguments are passed to functions
and how changes within those functions affect the original variables. Pass by
value creates a copy of the argument, ensuring that modifications within the
function do not affect the original variable. Pass by reference, on the other hand,
passes a reference (or address) to the original variable, allowing the function to
directly modify it. Pass by value-returned combines aspects of both, passing a
copy of the value but returning a potentially modified copy back to the caller.
Finally, pass by name (also known as call by name) is a more complex mechanism
that delays evaluation of the argument until it is actually used within the function,
allowing for more flexible and sometimes surprising behavior. This document will
provide a detailed explanation of each of these mechanisms, highlighting their
differences, advantages, and disadvantages.
REFERENCES
https://www.tutorialspoint.com
https://www.sciencedirect.com
64
https://www.docisty.com
https://www.geeksforgeeks.com
https://www.studoc.com
65