System Programming & Microprocessor
System Programming & Microprocessor
System Software
System software refers to the low-level software that manages and controls a
computer’s hardware and provides basic services to higher-level software.
There are two main types of software: systems software and application
software. Systems software includes the programs that are dedicated to
managing the computer itself, such as the operating system, file management
utilities, and disk operating system (or DOS).
Your system has three basic types of software: application programs, device
drivers, and operating systems. Each type of software performs a completely
different job, but all three work closely together to perform useful work. While
some special-purpose programs do not fit neatly into any of these classes,
most software does. Programs run in the memory portion of the system. While
running, programs are known as processes or jobs. The
following illustration shows the relationship between the different software
programs and the hardware.
Application Programs
Application programs are the top software layer. You can perform specific
tasks with these programs, such as using a word processor for writing, a
spreadsheet for accounting, or a computer-aided design program for drawing.
The other two layers, device drivers and the operating system, play important
support roles. Your system might run one application program at a time, or it
might run many simultaneously.
Device Drivers
Device drivers are a set of highly specialized programs. Device drivers help
application programs and the operating system do their tasks. Device drivers
(in particular, adapters), do not interact with you. They interact directly with
computer hardware elements and shield the application programs from the
hardware specifics of computers.
Operating System
Root-User Processes
Root-user processes are programs that can be run only by a user with root
authority. A system administrator has root authority for all processes.
When you are not allowed to run a command, the system displays a message
saying you do not have the correct permissions or you are not allowed to run
that command. The system administrator may be the only person who can log
in as root on your system. The system administrator can also set you up to
use particular commands, giving you some control over processes.
1. Instruction Interpreter
2. Location Counter
3. Instruction Register
4. Working Registers
5. General Register
The working registers are often called as the "scratch pads" because they are
used to store temporary values while calculation is in progress.
Memory controller is used to transfer data between MBR & the memory
location specified by MAR
Machine Language:
Each CPU has its own specific machine language. The processor reads and
handles instructions, which tell the CPU to perform a simple task. Instructions
are comprised of a certain number of bits. If instructions for a particular
processor are 8 bits, for example, the first 4 bits part (the opcode) tells the
computer what to do and the second 4 bits (the operand) tells the computer
what data to use.
Depending upon the processor, a computer's instruction sets may all be the
same length, or they may vary, depending upon the specific instruction. The
architecture of the particular processor determines how instructions are
patterned. The execution of instructions is controlled by firmware or the CPU's
internal wiring.
Human programmers rarely, if ever, deal directly with machine code anymore.
If developers are debugging a program at a low level, they might use a
printout that shows the program in its machine code form. The printout, which
is called a dump, is very difficult and to work with a tool called a dump. Utility
programs used to create dumps will often represent four bits by a
single hexadecimal to make the machine code easier to read and contain
other information about the computer's operation, such as the address of the
instruction that was being executed at the time the dump was initiated.
As you might have guessed already, each place weight differs from the one
before it by a factor of sixteen.
Let’s count again from zero to twenty using decimal, binary, octal, and
hexadecimal to contrast these systems of numeration:
Zero 0 0 0 0
One 1 1 1 1
Two 2 10 2 2
Three 3 11 3 3
Four 4 100 4 4
Five 5 101 5 5
Six 6 110 6 6
Seven 7 111 7 7
Eight 8 1000 10 8
Nine 9 1001 11 9
Ten 10 1010 12 A
Eleven 11 1011 13 B
Twelve 12 1100 14 C
Thirteen 13 1101 15 D
Fourteen 14 1110 16 E
Fifteen 15 1111 17 F
Sixteen 16 10000 20 10
Seventeen 17 10001 21 11
Eighteen 18 10010 22 12
Nineteen 19 10011 23 13
Twenty 20 10100 24 14
Assembly Language:
Assembly language is a low-level language that helps to communicate
directly with computer hardware. It uses mnemonics to represent the
operations that a processor has to do. Which is an intermediate language
between high-level languages like C++ and the binary language. It uses
hexadecimal and binary values, and it is readable by humans.
Compiled Languages
This a little different from interpreted languages, in this first the code is
transformed into a executable code, in machine language . Two ways of
compilation are there first is by machine code generation other is by
Intermediate representation.
• Machine code generation- In this the code is compiled by compilers
into machine code then they are executed.
•In intermediate representation the code is first, compiled to
intermediate representation which is saved so that there is no need
to read source file again. When its saved it forms a byte code which
can be executed by the machine.
some compiled languages are C, C++, Java.
Transcompile Languages
This is also known as Source-to-source translation Because in this the
source code of one language is converted into source code of another
programming language. This is done so that code can be used for multiple
platforms. Some transcompile languages are TypeScript, Coffee Script etc.
Use of High Level Language
• Web Development: Web development can be easily done using
html, css, JavaScript they are high level languages because they
are easy to understand and make the web development easy to
learn for everyone.
• Data Analysis: R and Python are the most popular languages for
data analysis, data analysts use them for study large amount of
data due to different libraries and data manipulation capabilities.
• DBMS(Data Base Management System): Its a place your data is
stored and managed. Like if you create website you need to store
data somewhere such as files, coding etc. So php and sql are high
level languages which help us storing and accessing the data.
• Game Development: Nowadays gaming is getting popular, what
makes it possible to build these complicated high graphic games,
width lot of buttons, accessibility. It because of high level languages
which makes game development possible.
Advantages of High Level Languages
• The biggest advantage of using high level languages is that they
are easy to understand, remember, learn, writing codes, to debug.
• There are different libraries available which can be used for
development, many defined operators, data types and frameworks
also which reduce the amount we need to write.
• They are portable to use, means we can use there code for
different platforms without much modification.
• It provides a higher level of abstraction, means it hides the
complexities of hardware from the programmer. You don’t need to
know about hardware before writing program.
Disadvantages of High level Languages
• High Level languages are slower as compared to low level
languages because there is more level of abstraction with hardware
so they require more processing and more memory for execution
• High level languages have less control over hardware, because the
complexities of hardware for the programmer in high level
languages.
• For the maximum utilization of hardware or CPU in terms of
performance low level languages are best.
UNIT- II
Assembler
Assembler is a program for converting instructions written in low-level
assembly code into relocatable machine code and generating along
information for the loader.
Assembly Program:
Label Op-code operand LC value(Location counter)
JOHN START 200
MOVER R1, ='3' 200
MOVEM R1, X 201
L1 MOVER R2, ='2' 202
LTORG 203
X DS 1 204
END 205
=’3′ –––
Symbol Address
X –––
X –––
L1 202
Literal Address
=’3′ –––
=’2′ –––
=’3′ 203
=’2′ –––
Step-6: X DS 1 204
It is a data declaration statement i.e X is assigned data space of 1. But X is a
symbol which was referred earlier in step 3 and defined in step 6.This
condition is called Forward Reference Problem where variable is referred prior
to its declaration and can be solved by back-patching. So now assembler will
assign X the address specified by LC value of current step.
Symbol Address
X 204
L1 202
X 204
L1 202
Literal Address
=’3′ 203
Literal Address
=’2′ 205
Now tables generated by pass 1 along with their LC value will go to pass-2 of
assembler for further processing of pseudo-opcodes and machine op-codes.
Working of Pass-2:
Pass-2 of assembler generates machine code by converting symbolic
machine-opcodes into their respective bit configuration(machine
understandable form). It stores all machine-opcodes in MOT table (op-code
table) with symbolic code, their length and their bit configuration. It will also
process pseudo-ops and will store them in POT table(pseudo-op table).
Various Data bases required by pass-2:
1. MOT table(machine opcode table)
2. POT table(pseudo opcode table)
3. Base table(storing value of base register)
4. LC ( location counter)
Line editor:
In computing, a line editor is a text editor in which each editing command
applies to one or more complete lines of text designated by the user. Line
editors predate screen-based text editors and originated in an era when a
computer operator typically interacted with a teleprinter (essentially
a printer with a keyboard), with no video display, and no ability to move a
cursor interactively within a document. Line editors were also a feature of
many home computers, avoiding the need for a more memory-intensive full-
screen editor.
Line editors are limited to typewriter keyboard text-oriented input and output
methods. Most edits are a line-at-a-time. Typing, editing, and document
display do not occur simultaneously. Typically, typing does not enter text
directly into the document. Instead, users modify the document text by
entering these commands on a text-only terminal. Commands and text, and
corresponding output from the editor, will scroll up from the bottom of the
screen in the order that they are entered or printed to the screen. Although the
commands typically indicate the line(s) they modify, displaying the edited text
within the context of larger portions of the document requires a separate
command.
Line editors keep a reference to the "current line" to which the entered
commands usually are applied. In contrast, modern screen based editors
allow the user to interactively and directly navigate, select, and modify
portions of the document. Generally line numbers or a search based context
(especially when making changes within lines) are used to specify which part
of the document is to be edited or displayed.
Line editors are still used non-interactively in shell scripts and when dealing
with failing operating systems. Update systems such as patch traditionally
used diff data converted into a script of ed commands. They are also used in
many MUD systems, though many people edit text on their own computer
using MUD's download and upload features.
Screen editors:
In this type of editors, the user is able to see the cursor on the screen and
can make a copy, cut, paste operation easily. It is very easy to use mouse
pointer.
• Screen editor uses the what you see is what you get principle in editor
design.
• A editor displays a screenful of text at a time. The user can move the cursor
over the screen, position it at the point where user desires to perform some
editing and proceed with the editing directly.
• The user has full control over the entire terminal. For example over an type
exiting string which user wishes to replace. User can bring the cursor over a
character to be deleted and press a delete key.
Debug Monitor:
It will provide details regarding the target system execution and in case of any
error this information will be useful for developers to fix the issue. Some debug
monitors records the error event and reproduce it based on the developer’s
need.
UNIT- III
Components of System Programming
Compiler Pass:
A Compiler pass refers to the traversal of a compiler through the entire
program. Compiler passes are of two types Single Pass Compiler, and Two
Pass Compiler or Multi-Pass Compiler. These are explained as follows.
Types of Compiler Pass
1. Single Pass Compiler
If we combine or group all the phases of compiler design in a single module
known as a single pass compiler.
It scans the entire file only once. It requires two passes to scan the source file.
It is faster than two pass assembler It is slower than two pass assembler
Absolute Loader:
The absolute loader transfers the text of the program into memory at the
address provided by the assembler after reading the object program line by
line. There are two types of information that the object program must
communicate from the assembler to the loader.
It must convey the machine instructions that the assembler has created
along with the memory address.
It must convey the start of the execution. At this point, the software will begin
to run after it has loaded.
The object program is the sequence of the object records. Each object
record specifies some specific aspect of the program in the object module.
There are two types of records:
Text record containing a binary image of the assembly program.
Transfer the record that contains the execution’s starting or entry point.
The formats of text and transfer records are shown below:
Algorithm:
The algorithm for the absolute loader is quite simple. The object file is read
record by record by the loader, and the binary image is moved to the
locations specified in the record. The final record is a transfer record. When
the control reaches the transfer record, it is transferred to the entry point for
execution.
Flowchart:
Subroutine Linkage Relocating:
A set of instructions that are used repeatedly in a program can be referred
to as a Subroutine. Only one copy of this Instruction is stored in the memory.
When a Subroutine is required it can be called many times during the
Execution of a particular program. A call Subroutine Instruction calls the
Subroutine. Care Should be taken while returning a Subroutine as a
Subroutine can be called from a different place from the memory.
The content of the PC must be Saved by the call Subroutine Instruction to
make a correct return to the calling program.
The subroutine linkage method is a way in which computers call and return
the Subroutine. The simplest way of Subroutine linkage is saving the return
address in a specific location, such as a register which can be called a link
register called Subroutine.
Advantages of Subroutines
Disadvantages of Subroutines
From the above figure, assume that when Subroutine 1 calls Subroutine 2
the return address of Subroutine 2 should be saved somewhere. So if the
link register stores the return address of Subroutine 1 this will be
(destroyed/overwritten) by the return address of Subroutine 2. As the last
Subroutine called is the first one to be returned ( Last in first out format). So
stack data structure is the most efficient way to store the return addresses of
the Subroutines.
Introduction: The direct linking loader is the most common type of loader. This
type of loader is a re - locatable loader. The loader cannot have the direct
access to the source code. And to place the object code in the memory there
are two situations: either the address of the object code could be absolute
which then can be directly placed at the specified location or the address can
be relative. If at all the address is relative then it is the assembler who informs
the loader about the relative addresses.
The list of symbols which are not defined in the current segment but can be
used in the current segment are stored in a data structure called USE table.
The USE table holds the information such as name of the symbol, address,
and address relativity.
The lists of symbols which are defined in the current segment and can be
referred by the other segments are stored in a data structure called
DEFINITION table. The definition table holds the information such as symbol,
address.
· Symbol Name
· TYPE
· Relative Location
· Length
· Reference no
· Reference No
· Symbol
· Flag
· Length
· Relative Location
4. END - Indicates the end of the program and specifies starting address of for
execution
Advantages: The main task of loader is to load a source program into memory
and prepares it for further execution. In pass - I direct link loader allocates
segments and define symbols for lexical analysis. Each symbol in the phase
assigned to next available location after proceeding. Segment in order to
minimize the amount of storage required for the total program. Hence pass - I
deals with only for allocating segment and defining symbols
Therefore pass - I of Direct Link Loader (DLL) is limited scope and is obelized
to mainly deals for allocation of segments and defining symbols.
Types of Operating Systems:
There are several types of Operating Systems which are mentioned below.
• Batch Operating System
• Multi-Programming System
• Multi-Processing System
• Multi-Tasking Operating System
• Time-Sharing Operating System
• Distributed Operating System
• Network Operating System
• Real-Time Operating System
1. Batch Operating System
This type of operating system does not interact with the computer directly.
There is an operator which takes similar jobs having the same requirement
and groups them into batches. It is the responsibility of the operator to sort
jobs with similar needs.
Examples of Batch Operating Systems: Payroll Systems, Bank
Statements, etc.
1.Security
To safeguard user data, the operating system employs password protection
and other related measures. It also protects programs and user data from
illegal access.
3.Job Accounting
The operating system maintains track of how much time and resources are
consumed by different tasks and users, and this data can be used to
measure resource utilisation for a specific user or group of users.
6.Memory Management
The operating system is in charge of managing the primary memory, often
known as the main memory. The main memory consists of a vast array of
bytes or words, each of which is allocated an address. Main memory is rapid
storage that the CPU can access directly. A program must first be loaded
into the main memory before it can be executed. For memory management,
the OS performs the following tasks:
• The OS keeps track of primary memory – meaning, which user
program can use which bytes of memory, memory addresses that
have already been assigned, as well as memory addresses yet to be
used.
• The OS determines the order in which processes would be permitted
memory access and for how long in multiprogramming.
• It allocates memory to the process when the process asks for it and
deallocates memory when the process exits or performs an I/O activity.
7.Process Management
The operating system determines which processes have access to the
processor and how much processing time every process has in a
multiprogramming environment. Process scheduling is the name for this
feature of the operating system. For processor management, the OS
performs the following tasks:
• It keeps track of how processes are progressing.
• A traffic controller is a program that accomplishes this duty.
• Allocates a processor-based CPU to a process. When a process is no
longer needed, the processor is deallocated.
8.Device Management
A file system is divided into directories to make navigation and usage more
efficient. Other directories and files may be found in these directories. The
file management tasks performed by an operating system are: it keeps track
of where data is kept, user access settings, and the state of each file, among
other things. The file system is the name given to all of these features.
UNIT- IV
The accumulator is an 8-bit register that is used to store arithmetic and logical
results. It is the most commonly used register in the 8085 microprocessor and
is used to perform arithmetic and logical operations such as addition,
subtraction, and bitwise operations.
The program counter is a 16-bit register that contains the memory address of
the next instruction to be executed. The program counter is incremented after
each instruction is executed, which allows the microprocessor to execute
instructions in sequence.
The stack pointer is a 16-bit register that is used to manage the stack. The
stack is a section of memory that is used to store data temporarily, such as
subroutine addresses and other data. The stack pointer is used to keep track
of the top of the stack.
The instruction register is an 8-bit register that contains the current instruction
being executed. The instruction register is used by the microprocessor to
decode and execute instructions.
2.The flags register is an 8-bit register that contains status flags that indicate
the result of an arithmetic or logical operation. These flags include the carry
flag, zero flag, sign flag, and parity flag. The carry flag is set when an
arithmetic operation generates a carry, the zero flag is set when the result of
an arithmetic or logical operation is zero, the sign flag is set when the result of
an arithmetic or logical operation is negative, and the parity flag is set when
the result of an arithmetic or logical operation has an even number of 1 bits.
3.The data bus is an 8-bit bus that is used to transfer data between the
microprocessor and memory or other devices. The data bus is bidirectional,
which means that it can be used to read data from memory or write data to
memory.
The address bus is a 16-bit bus that is used to address memory and other
devices. The address bus is used to select the memory location or device that
the microprocessor wants to access.
4.The control bus is a set of signals that controls the operations of the
microprocessor, including the read and write operations. The control bus
includes signals such as the read signal, write signal, interrupt signal, and
reset signal. The read signal is used to read data from memory or other
devices, the write signal is used to write data to memory or other devices, the
interrupt signal is used to signal the microprocessor that an interrupt has
occurred, and the reset signal is used to reset the microprocessor to its initial
state.
Flag Register:
1. Carry Flag
2. Parity Flag
4. Zero Flag
5. Sign Flag
Accumulator:
Program Counter :
Program Counter holds the address value of the memory to the next
instruction that is to be executed. It is a 16-bit register.
Stack Pointer :
It works like a stack. In stack, the content of the register is stored that is later
used in the program. It is a 16-bit special register. The stack pointer is part of
memory but it is part of Stack operations, unlike random memory access.
Stack pointer works in a continuous and contiguous part of the memory.
whereas Program Counter(PC) works in random memory locations. This
pointer is very useful in stack-related operations like PUSH, POP, and nested
CALL requests initiated by Microprocessor. It reserves the address of the
most recent stack entry.
Temporary Register:
It is an 8-bit register that holds data values during arithmetic and logical
operations.
It is an 8-bit register that holds the instruction code that is being decoded. The
instruction is fetched from the memory.
Interrupt control:
Priorities of Interrupts: TRAP > RST 7.5 > RST 6.5 > RST 5.5 > INTR
The data bus is bidirectional and carries the data which is to be stored. The
address bus is unidirectional and carries the location where data is to be
stored.
In the 8085 microprocessor, the address bus and data bus are two separate
buses that are used for communication between the microprocessor and
external devices.
The Address bus is used to transfer the memory address of the data that
needs to be read or written. The address bus is a 16-bit bus, allowing the
8085 to access up to 65,536 memory locations.
The Data bus is used to transfer data between the microprocessor and
external devices such as memory and I/O devices. The data bus is an 8-bit
bus, allowing the 8085 to transfer 8-bit data at a time. The data bus can also
be used for instruction fetch operations, where the microprocessor fetches the
instruction code from memory and decodes it.
The combination of the address bus and data bus allows the 8085 to
communicate with and control external devices, allowing it to execute its
program and perform various operations.
It controls the serial data communication by using Serial input data and Serial
output data.
Serial Input/Output control in the 8085 microprocessor refers to the
communication of data between the microprocessor and external devices in a
serial manner, i.e., one bit at a time. The 8085 has a serial I/O port (SID/SOD)
for serial communication. The SID pin is used for serial input and the SOD pin
is used for serial output. The timing and control of serial communication is
managed by the 8085’s internal circuitry. The 8085 also has two special
purpose registers, the Serial Control Register (SC) and the Serial Shift
Register (SS), which are used to control and monitor the serial
communication.
3. After data fetching data will go into the Instruction Register it will store
data fetched from memory and now data is ready for decoding so for
this Instruction decoder register is used.
4. After that timing and control signal circuit comes into the picture. It
sends control signals all over the microprocessor to tell the
microprocessor whether the given instruction is for READ/WRITE and
whether it is for MEMORY/I-O Device activity.
5. Hence according to timing and control signal pins, logical and arithmetic
operations are performed and according to that data fetching from the
different registers is done by a microprocessor, and mathematical
operation is carried out by ALU. And according to operations Flag
register changes dynamically.
6. With the help of Serial I/O data pin(SID or SOD Pins) we can send or
receive input/output to external devices .in this way execution cycle is
carried out.
Inrtoduction :
The instruction cycle of the 8085 microprocessor consists of four basic steps,
which are:
1. Fetch: In this step, the microprocessor fetches the instruction from the
memory location pointed to by the program counter (PC). The PC is
incremented by one after the fetch operation.
The 8086 microprocessor has two main execution units: the execution unit
(EU) and the bus interface unit (BIU). The BIU is responsible for fetching
instructions from memory and decoding them, while the EU executes the
instructions. The BIU also manages data transfer between the
microprocessor and memory or I/O devices.
The 8086 microprocessor has a rich set of registers, including general-
purpose registers, segment registers, and special registers. The general-
purpose registers can be used to store data and perform arithmetic and
logical operations, while the segment registers are used to address memory
segments. The special registers include the flags register, which stores
status information about the result of the previous operation, and the
instruction pointer (IP), which points to the next instruction to be executed.
A Microprocessor is an Integrated Circuit with all the functions of a CPU.
However, it cannot be used stand-alone since unlike a microcontroller it has
no memory or peripherals.
8086 does not have a RAM or ROM inside it. However, it has internal
registers for storing intermediate and final results and interfaces with
memory located outside it through the System Bus.
The size of the internal registers(present within the chip) indicates how much
information the processor can operate on at a time (in this case 16-bit
registers) and how it moves data around internally within the chip,
sometimes also referred to as the internal data bus.
8086 provides the programmer with 14 internal registers, each of 16 bits or 2
bytes wide. The main advantage of the 8086 microprocessor is that it
supports Pipelining.
Memory segmentation:
• In order to increase execution speed and fetching speed, 8086
segments the memory.
• Its 20-bit address bus can address 1MB of memory, it segments it
into 16 64kB segments.
• 8086 works only with four 64KB segments within the whole 1MB
memory.
The internal architecture of Intel 8086 is divided into 2 units: The Bus
Interface Unit (BIU), and The Execution Unit (EU). These are explained as
following below.
It provides the interface of 8086 to external memory and I/O devices via the
System Bus. It performs various machine cycles such as memory read, I/O
read, etc. to transfer data between memory and I/O devices.
Code Segment register: (16 Bit register): CS holds the base address for
the Code Segment. All programs are stored in the Code Segment and
accessed via the IP.
Data Segment register: (16 Bit register): DS holds the base address for
the Data Segment.
Stack Segment register: (16 Bit register): SS holds the base address for
the Stack Segment.
Extra Segment register: (16 Bit register): ES holds the base address for
the Extra Segment.
Please note that segments are present in memory and segment registers are
present in Microprocessor.
Segment registers store starting address of each segments in memory.
2.prefetch unit:
The main components of the EU are General purpose registers, the ALU,
Special purpose registers, the Instruction Register and Instruction Decoder,
and the Flag/Status Register.
1. Fetches instructions from the Queue in BIU, decodes, and executes
arithmetic and logic operations using the ALU.
2. Sends control signals for internal data transfer operations within the
microprocessor.(Control Unit)
3. Sends request signals to the BIU to access the external module.
4. It operates with respect to T-states (clock cycles) and not machine
cycles.
8086 has four 16-bit general purpose registers AX, BX, CX, and DX which
store intermediate values during execution. Each of these has two 8-bit parts
(higher and lower).
• AX register: (Combination of AL and AH Registers)
It holds operands and results during multiplication and division
operations. Also an accumulator during String operations.
Arithmetic Logic Unit (16-bit): Performs 8 and 16-bit arithmetic and logic
operations.
Flag/Status register (16 bits): It has 9 flags that help change or recognize
the state of the microprocessor.
6 Status flags:
1. Carry flag(CF)
2. Parity flag(PF)
3. Auxiliary carry flag(AF)
4. Zero flag(Z)
5. Sign flag(S)
6. Overflow flag (O)
Status flags are updated after every arithmetic and logic operation.
3 Control flags:
1. Trap flag(TF)
2. Interrupt flag(IF)
3. Direction flag(DF)
These flags can be set or reset using control instructions like CLC, STC,
CLD, STD, CLI, STI, etc. The Control flags are used to control certain
operations.
4.Decode unit:
5.control unit :
The 8086 microprocessor uses three different buses to transfer data and
instructions between the microprocessor and other components in a
computer system. These buses are:
1.Address Bus: The address bus is used to send the memory address of
the instruction or data being read or written. The address bus is 16 bits wide,
allowing the 8086 to address up to 64 kilobytes of memory.
2.Data Bus: The data bus is used to transfer data between the
microprocessor and memory. The data bus is 16 bits wide, allowing the 8086
to transfer 16-bit data words at a time.
3.Control Bus: The control bus is used to transfer control signals between
the microprocessor and other components in the computer system. The
control bus is used to send signals such as read, write, and interrupt
requests, and to transfer status information between the microprocessor and
other components.
The buses in the 8086 microprocessor play a crucial role in allowing the
microprocessor to access and transfer data from memory, as well as to
interact with other components in the computer system. The 8086’s ability to
use these buses efficiently and effectively helps to ensure that it remains
competitive in its performance and capabilities, even as technology
continues to advance.
Execution of whole 8086 Architecture:
1. All instructions are stored in memory hence to fetch any instruction
first task is to obtain the Physical address of the instruction is to be
fetched. Hence this task is done by Bus Interface Unit (BIU) and by
Segment Registers. Suppose the Code segment has a Segment
address and the Instruction pointer has some offset address then
the physical address calculator circuit calculates the physical
address in which our instruction is to be fetched.
2. After the address calculation instruction is fetched from memory
and it passes through C-Bus (Data bus) as shown in the figure, and
according to the size of the instruction, the instruction pre-fetch
queue fills up. For example MOV AX, BX is 1 Byte instruction so it
will take only the 1st block of the queue, and MOV BX,4050H is 3
Byte instruction so it will take 3 blocks of the pre-fetch queue.
3. When our instruction is ready for execution, according to the FIFO
property of the queue instruction comes into the control system or
control circuit which resides in the Execution unit. Here instruction
decoding takes place. The decoding control system generates an
opcode that tells the microprocessor unit which operation is to be
performed. So the control system sends signals all over the
microprocessor about what to perform and what to extract from
General and Special Purpose Registers.
4. Hence after decoding microprocessor fetches data from GPR and
according to instructions like ADD, SUB, MUL, and DIV data
residing in GPRs are fetched and put as ALU’s input. and after that
addition, multiplication, division, or subtraction whichever
calculation is to be carried out.
5. According to arithmetic, flag register values change dynamically.
6. While Instruction was decoding and executing from step-3 of
our algorithm, the Bus interface Unit doesn’t remain idle. it
continuously fetches an instruction from memory and put it in
a pre-fetch queue and gets ready for execution in a FIFO
manner whenever the time arrives.
7. So in this way, unlike the 8085 microprocessor, here the fetch,
decode, and execution process happens in parallel and not
sequentially. This is called pipelining, and because of the instruction
pre-fetch queue, all fetching, decoding, and execution process
happen side-by-side. Hence there is partitioning in 8086
architecture like Bus Interface Unit and Execution Unit to support
Pipelining phenomena.
Advantages of Architecture of 8086:
The architecture of the 8086 microprocessor provides several advantages,
including:
1. Wide range of instructions: The 8086 microprocessor supports a
wide range of instructions, allowing programmers to write complex
programs that can perform many different operations.
2. Segmented memory architecture: The segmented memory
architecture allows the 8086 microprocessor to address large
amounts of memory, up to 1 MB, while still using a 16-bit data bus.
3. Powerful instruction set: The instruction set of the 8086
microprocessor includes many powerful instructions that can
perform multiple operations in a single instruction, reducing the
number of instructions needed to perform a given task.
4. Multiple execution units: The 8086 microprocessor has two main
execution units, the execution unit and the bus interface unit, which
work together to efficiently execute instructions and manage data
transfer.
5. Rich set of registers: The 8086 microprocessor has a rich set of
registers, including general-purpose registers, segment registers,
and special registers, allowing programmers to efficiently
manipulate data and control program flow.
6. Backward compatibility: The architecture of the 8086
microprocessor is backward compatible with earlier 8-bit
microprocessors, allowing programs written for these earlier
microprocessors to be easily ported to the 8086 microprocessor.
Dis-advantages of Architecture of 8086:
The architecture of the 8086 microprocessor has some disadvantages,
including:
1. Complex programming: The architecture of the 8086
microprocessor is complex and can be difficult to program,
especially for novice programmers who may not be familiar with the
assembly language programming required for the 8086
microprocessor.
2. Segmented memory architecture: While the segmented memory
architecture allows the 8086 microprocessor to address a large
amount of memory, it can be difficult to program and manage, as it
requires programmers to use both segment registers and offsets to
address memory.
3. Limited performance: The 8086 microprocessor has a limited
performance compared to modern microprocessors, as it has a
slower clock speed and a limited number of execution units.
4. Limited instruction set: While the 8086 microprocessor has a wide
range of instructions, it has a limited instruction set compared to
modern microprocessors, which can limit its functionality and
performance in certain applications.
5. Limited memory addressing: The 8086 microprocessor can only
address up to 1 MB of memory, which can be limiting in applications
that require large amounts of memory.
6. Lack of built-in features: The 8086 microprocessor lacks some built-
in features that are commonly found in modern microprocessors,
such as hardware floating-point support and virtual memory
management.
Addressing modes in 8086 microprocessor
• the given
modes:
Addressing
operated
that
whether1. the
bymodes
given
andata
instruction
Register operand
is
in an
8085
mode immediate
–isis
microprocessor
Inknown
registerdata
asoraddressing
this type ofregister
oraddressing
an
Theaddress.
way
pair.modes.
of
Types
specifying
It also
mode of
This
bothspecifies
addressing
specifies
data
the to be
operands
are registers. Example:
2. MOV AX, BX
3. XOR AX, DX
ADD AL, BL
4. Immediate mode – In this type of addressing mode the source
operand is a 8 bit or 16 bit data. Destination operand can never be
immediate data. Example:
5. MOV AX, 2000
6. MOV CL, 0A
7. ADD AL, 45
AND AX, 0000
Note that to initialize the value of segment register an register is
required.
0 0 0 PORT A 80 H
0 0 1 PORT B 81 H
0 1 0 PORT C 82 H
0 1 1 Control Register 83 H
1 X X No Seletion X
Pin diagram –
• PA0 – PA7 – Pins of port A
• PB0 – PB7 – Pins of port B
• PC0 – PC7 – Pins of port C
• D0 – D7 – Data pins for the transfer of data
• RESET – Reset input
• RD’ – Read input
• WR’ – Write input
• CS’ – Chip select
• A1 and A0 – Address pins
Operating modes –
1. Bit set reset (BSR) mode – If MSB of control word (D7) is 0, PPI
works in BSR mode. In this mode only port C bits are used for set
or reset.
• Mode 0 –In this mode all the three ports (port A, B, C) can
work as simple input function or simple output function. In
this mode there is no interrupt handling capacity.
• Mode 1 – Handshake I/O mode or strobed I/O mode. In
this mode either port A or port B can work as simple input
port or simple output port, and port C bits are used for
handshake signals before actual data transmission. It has
interrupt handling capacity and input and output are
latched. Example: A CPU wants to transfer data to a
printer. In this case since speed of processor is very fast
as compared to relatively slow printer, so before actual
data transfer it will send handshake signals to the printer
for synchronization of the speed of the CPU and the
peripherals.
the ADC. The ADC converts this analog input to a digital output. This
digital output consists of a number of bits that represent the value of the
analog input. For example, the ADC might convert the transducer’s 800-
to 10010110 (150). Note that the binary output from the ADC is
proportional to the analog input voltages so that each unit of the digital
ADC to the digital computer, which stores the digital value and
Digital-to-Analog Conversion
The digital inputs D,C,B, and A are usually derived from the output
represented by these 4 bits for each input number, the D/A converter
output voltage is a unique value. In fact, for this case, the analog output
In general,
We can use this to calculate VOUT for any value of digital input. For
VOUT = 1V × 12 = 12V
Digital-to-Analog Converter (DAC)
Input-Output Interface
In micro-computer base system, the only purpose of peripheral devices is just
to provide special communication links for the interfacing them with the
CPU. To resolve the differences between peripheral devices and CPU, there
is a special need for communication links.
The major differences are as follows:
1. The nature of peripheral devices is electromagnetic and electro-
mechanical. The nature of the CPU is electronic. There is a lot of
difference in the mode of operation of both peripheral devices and
CPU.
2. There is also a synchronization mechanism because the data
transfer rate of peripheral devices are slow than CPU.
3. In peripheral devices, data code and formats are differ from the
format in the CPU and memory.
4. The operating mode of peripheral devices are different and each
may be controlled so as not to disturb the operation of other
peripheral devices connected to CPU.
There is a special need of the additional hardware to resolve the differences
between CPU and peripheral devices to supervise and synchronize all input
and output devices.
Functions of Input-Output Interface:
1. It is used to synchronize the operating speed of CPU with respect to
input-output devices.
2. It selects the input-output device which is appropriate for the
interpretation of the input-output signal.
3. It is capable of providing signals like control and timing signals.
4. In this data buffering can be possible through data bus.
5. There are various error detectors.
6. It converts serial data into parallel data and vice-versa.
7. It also convert digital data into analog signal and vice-versa.
Memory Interfacing:
Memory requires some signals to read from and write to registers and
microprocessor transmits some signals for reading or writing data.
The interfacing process includes matching the memory requirements with the
microprocessor signals. Therefore, the interfacing circuit should be designed
in such a way that it matches the memory signal requirements with the
microprocessor's signals.
The Intel 8279 is a programmable keyboard interfacing device. Data input and
display are the integral part of microprocessor kits and microprocessor-based
systems.
8279 has been designed for the purpose of 8-bit Intel microprocessors.
8279 has two sections namely keyboard section and display section.
Intel 8257
o The Intel 8257 is a programmable DMA controller.
o It is a 4-channel programmable Direct Memory Access
(DMA) controller.
o It is a 40 pin I.C. package and requires +5V supply for its operation.
o It can perform three operations, namely read, write, and verify.
o Each channel incorporates two 16-bit registers, namely DMA address
register and byte count register.
o Each channel can transfer data up to 64kb and can be programmed
independently.
o It operates in 2 -modes: Master mode and Slave mode.
8257 Architecture
8257 Pin Description
DRQ0 - DRQ3: These are DMA request lines. An I/O device sends the DMA
request on one of these lines. On the line, a HIGH status generates a DMA
request.
DACK0 - DACK3 : These are DMA acknowledge lines. The Intel 8257 sends
an acknowledge signal through one of these lines informing an I/O device that
it has been selected for DMA data transfer. On the line, a LOW acknowledges
the I/O device.
A0 - A7: These are address lines. A0 - A3 are bidirectional lines. These lines
carry 4 LSBs of 16-bit memory address generated by the 8257 in the master
mode. In the slave mode, these lines are all the input lines. The inputs select
one from the registers to be read or programmed. A4 - A7 lines gives tristated
outputs in the master mode which carry 4 through 7 of the 16-bit memory
address generated by the Intel 8257.
D0 - D7: These are data lines. These are bidirectional three state lines. While
programming the controller the CPU sends data for the DMA address register,
the byte count register and the mode set register through these data lines.
AD
AD
ADSTB: A HIGH on this line latches the 8MSBs of the address, which are
sent on D-bus, into Intel 8212 connected for this purpose.
(I/OW): I/O write. It is a bidirectional line. In output mode it allows the transfer
of data to the I/O device during the DMA read cycle. Data is transferred from
the memory.
CLK: Clock