MP 8085 Notes
MP 8085 Notes
● Arithmetic and logic unit (ALU): The ALU performs arithmetic and logical
operations on data.
● Control unit: The control unit manages the flow of execution of instructions.
● Registers: Registers are used to store temporary data.
● Bus system: The bus system connects the microprocessor to the other
components of the computer system, such as memory and input/output
devices.
Types of Microprocessors
Applications of Microprocessors
COMPONENTS OF MICROPROCESSORS
The CU fetches instructions from memory and decodes them. It then sends the
decoded instructions to the ALU. The ALU performs the arithmetic and logical
operations specified by the instructions. The results of the operations are stored
in registers.
The CU may also send data to and from memory. The bus system is used to
connect the microprocessor to memory.
Registers are high-speed storage units that are used to store data and
instructions that are currently being processed by the microprocessor. They are
very fast, but they have a limited capacity. Registers are typically used to store
the following types of data:
The 8085 microprocessor has eight registers. These registers can be classified
into two main types: general-purpose registers and special-purpose registers.
1. General-purpose registers
The general-purpose registers can be used to store any type of data, including 8-
bit numbers, 16-bit addresses, and instructions. The general-purpose registers in
the 8085 microprocessor are:
● A (accumulator)
● B
● C
● D
● E
● H
● L
The special-purpose registers are used for specific tasks. The special-purpose
registers in the 8085 microprocessor are:
The program counter (PC) stores the address of the next instruction to be
executed. The stack pointer (SP) stores the address of the top of the stack. The
program status word (PSW) stores information about the status of the
microprocessor, such as the carry flag and the zero flag.
2 ALU
An arithmetic and logic unit (ALU) is a digital circuit that performs arithmetic and
logical operations on data. It is a key component of the central processing unit
(CPU) in a computer.
The ALU can also perform more complex operations, such as floating-point
arithmetic and bit-shifting.
The ALU is typically implemented as a combinational circuit. This means that the
output of the ALU is only dependent on the current input. Combinational circuits
are very fast, but they can be complex to design.
3 CONTROL AND TIMING
The control and timing units in a microprocessor work together to ensure that
instructions are executed correctly and efficiently. The control unit manages the
flow of execution of instructions, while the timing unit ensures that the different
components of the microprocessor are synchronized.
Here is an example of how the control and timing units work together:
The control and timing units are essential components of a microprocessor. They
work together to ensure that instructions are executed correctly and efficiently.
They help to ensure that instructions are executed correctly, efficiently, and
reliably.
4 SYSTEM BUS
● Data bus: The data bus carries data between the different components of
the computer system.
● Address bus: The address bus specifies the memory location or I/O device
that the microprocessor wants to access.
● Control bus: The control bus carries signals that control the operation of
the different components of the computer system.
The system bus is essential for the operation of a computer system. It allows the
microprocessor to communicate with the memory and I/O devices, which enables
the microprocessor to execute instructions and process data.
● Parallel bus: A parallel bus transmits data in parallel, meaning that all of
the bits of a data word are transmitted at the same time. Parallel buses are
typically faster than serial buses, but they are also more complex and
expensive to implement.
● Serial bus: A serial bus transmits data in series, meaning that the bits of a
data word are transmitted one at a time. Serial buses are typically slower
than parallel buses, but they are also simpler and less expensive to
implement.
Most modern computer systems use serial buses, such as PCI Express (PCIe)
and USB. Serial buses are more flexible and scalable than parallel buses, and
they can also support higher data rates.
Here are some examples of how the system bus is used in a computer system:
● When the microprocessor needs to read data from memory, it sends the
address of the memory location to the memory controller over the address
bus. The memory controller then reads the data from memory and sends it
to the microprocessor over the data bus.
● When the microprocessor needs to write data to memory, it sends the
address of the memory location and the data to be written to the memory
controller over the address bus and data bus, respectively. The memory
controller then writes the data to memory.
● When the microprocessor needs to communicate with an I/O device, it
sends the address of the I/O device to the I/O controller over the address
bus. The I/O controller then communicates with the I/O device.
● Instruction set architecture (ISA): The ISA is the set of instructions that a
microprocessor can understand and execute.
● Clock speed: The clock speed is the number of times per second that the
microprocessor can execute an instruction.
● Word size: The word size is the number of bits that the microprocessor
can operate on at a time.
● Pipeline: A pipeline is a technique that allows the microprocessor to
execute multiple instructions at the same time.
● Cache memory: Cache memory is a high-speed memory that stores
frequently accessed data and instructions.
The microprocessor performs the following four operations using the address bus,
data bus, and control bus:
● Memory Read: Reads data (or instruction) from memory.
● Memory Write: Writes data (or instruction) into memory.
● I/O Read: Accepts data from the input device.
● I/O Write: Sends data to the output device
MEMORY
In a computer system, various types of memory are used to store and manage data at
different stages of processing. These memory types serve specific purposes and have
different characteristics. Here are the main types of memory used in a typical computer:
1. Registers:
○ Type: CPU Registers
○ Characteristics: Fastest and smallest memory directly on the CPU.
○ Purpose: Registers store data that the CPU is actively processing. They are
used for immediate data manipulation and calculations.
2. Cache Memory:
○ Types: L1 Cache, L2 Cache, L3 Cache (in multi-core processors)
○ Characteristics: Fast and located close to the CPU.
○ Purpose: Cache memory temporarily stores frequently used data and
instructions to reduce the time it takes for the CPU to access them from
slower main memory.
3. Main Memory (RAM - Random Access Memory):
○ Type: RAM
○ Characteristics: Larger than cache memory, but slower.
○ Purpose: RAM stores the data and program code that the CPU is actively
using. It provides volatile storage, meaning data is lost when the computer is
powered off.
4. Virtual Memory:
○ Type: Virtual Memory
○ Characteristics: A portion of the hard drive or SSD used as an extension of
RAM.
○ Purpose: Virtual memory is used when RAM is insufficient. It allows the
computer to store data not immediately needed on disk and swap it in and out
of RAM as needed.
5. Solid-State Drives (SSD):
○ Type: SSD
○ Characteristics: Non-volatile storage with faster access times compared to
traditional HDDs.
○ Purpose: SSDs are used for long-term storage of the operating system,
applications, and user data.
6. Hard Disk Drives (HDD):
○ Type: HDD
○ Characteristics: Slower access times compared to SSDs, but with larger
storage capacity.
○ Purpose: HDDs are used for long-term storage of data and are often used in
systems where high capacity is more important than speed.
7. Optical Drives:
○ Type: CD/DVD/Blu-ray drives
○ Characteristics: Slow access times, used for reading and writing optical
discs.
○ Purpose: Optical drives are used for data backup, software installation, and
media playback.
8. Tape Drives:
○ Type: Magnetic tape drives
○ Characteristics: Very slow access times but high storage capacity.
○ Purpose: Tape drives are used for long-term data archival due to their low
cost per stored gigabyte.
9. External Storage Devices:
○ Type: External hard drives, USB flash drives, memory cards, etc.
○ Characteristics: Various speeds and capacities.
○ Purpose: External storage devices are used for portable data storage and
backup.
10. GPU Memory (VRAM):
○ Type: VRAM (Video RAM)
○ Characteristics: Specialized memory on a graphics processing unit (GPU).
○ Purpose: VRAM stores textures, frame buffers, and other data necessary for
rendering graphics in applications and games.
INPUT / OUTPUT DEVICES AND OPERATIONS
The type of I/O operation that is used depends on the I/O device and the
requirements of the application.
Here is an example of how programmed I/O might be used to read data from a
keyboard:
Here is an example of how interrupt-driven I/O might be used to read data from a
mouse:
DMA is typically used for high-speed I/O devices, such as hard disk drives and
network adapters. DMA allows the I/O device to directly access memory without
having to go through the microprocessor. This can significantly improve the
performance of I/O operations.
SO, S1 – These are status signals. They distinguish the various types of
operations such as halt, reading, instruction fetching or writing.
CLK (OUT) – This signal can be used as the system clock for other
devices.
5. Reset Signals:
RESET IN’ – When the signal on this pin is low(0), the program-counter is set to
zero, the buses are tristated and the microprocessor unit is reset.
RESET OUT – This signal indicates that the MPU is being reset. The
signal can be used to reset other devices.
6. DMA Signals:
SID and SOD – SID is a data line for serial input where as SOD is a data
line for serial output.
DEMULTIPLEXING OF BUSES
Multiplexing means that the same bus lines are used to carry both address and data
information at different times. This is done by using a control signal to indicate
whether the bus is carrying address or data information.
The demultiplexed address and data buses are then connected to the appropriate
devices, such as the memory and the I/O devices.
The 8085 microprocessor uses a control signal called ALE (Address Latch
Enable) to indicate whether the bus is carrying address or data information.
When ALE is high, the address bus is enabled and the data bus is disabled.
When ALE is low, the data bus is enabled and the address bus is disabled.
To demultiplex the address/data bus, a latch is used. The latch is enabled by the
ALE signal. When ALE is high, the latch stores the address information on the bus.
When ALE is low, the latch stores the data information on the bus.
The 8086 microprocessor has time-multiplexed 16-bit address/data bus
AD15-AD0 and 4-bit address/status bus A19/S6-A16/S3.
The 8085 microprocessor generates control signals to control the operation of the
memory and I/O devices. The control signals are generated by the 8085's internal
control unit.
The 8085 microprocessor has three control signals that are used to generate the
other control signals:
IO/M': Input/Output or Memory signal. This signal indicates whether the 8085
is accessing memory or an I/O device.
RD': Read signal. This signal indicates that the 8085 is reading data from
memory or an I/O device.
WR': Write signal. This signal indicates that the 8085 is writing data to
memory or an I/O device.
The other control signals are generated using a decoder. The decoder is a logic
circuit that takes a set of input signals and generates a set of output signals. The
decoder is configured to generate the following control signals:
MEMR': Memory Read signal. This signal is asserted when the 8085 is
reading data from memory.
MEMW': Memory Write signal. This signal is asserted when the 8085 is writing
data to memory.
IOR': I/O Read signal. This signal is asserted when the 8085 is reading data
from an I/O device.
IOW': I/O Write signal. This signal is asserted when the 8085 is writing data to
an I/O device
The control signal decoder is typically implemented using a 3-to-8 decoder IC, such
as the 74LS138. The three input signals to the decoder are IO/M', RD', and WR'. The
eight output signals from the decoder are MEMR', MEMW', IOR', and IOW'.
In the 8085 microprocessor, the generation of control signals is a crucial aspect of its
operation. These control signals are responsible for coordinating the various
activities within the microprocessor and ensuring that instructions are executed
correctly. The control signals are generated based on the contents of the instruction
register (IR) and the state of the microprocessor.
Here's a high-level explanation of how control signals are generated in the 8085
microprocessor:
1. Fetch Phase:
During the fetch phase, the microprocessor fetches the next instruction
from memory.
The program counter (PC) holds the address of the next instruction to
be executed.
2. Decode Phase:
During the decode phase, the instruction in the instruction register (IR)
is decoded to determine the operation to be performed.
Set or reset flags like the zero flag, sign flag, carry flag, and
parity flag based on the operation's result.
3. Execute Phase:
Enable the data paths for reading source operands and writing
the result.
Control signals are also generated to handle interrupts and control the
overall operation of the microprocessor.
For example, the interrupt control signals (e.g., INTA, RSTn) are
generated to manage interrupts from external devices.
INSTRUCTION CYCLE
In the context of the 8085 microprocessor, an instruction cycle, also known as a machine
cycle, refers to the time it takes to execute a single machine-level instruction. The instruction
cycle is composed of a series of smaller internal operations that the microprocessor
performs to fetch, decode, execute, and complete an instruction.
The 8085 microprocessor typically has a minimum of four machine cycles for each
instruction, although some instructions may require more cycles. These four basic machine
cycles are:
1. Fetch Cycle (T1): In the first machine cycle, the microprocessor fetches the
instruction from memory. The program counter (PC) provides the memory address of
the instruction to be fetched. During this cycle, the memory read operation is
performed, and the fetched instruction is loaded into the instruction register (IR).
2. Decode Cycle (T2): During the second machine cycle, the microprocessor decodes
the instruction stored in the instruction register (IR). The control unit generates
control signals based on the opcode (operation code) of the instruction to determine
the specific operation to be executed.
3. Execute Cycle (T3): In the third machine cycle, the actual execution of the instruction
takes place. The microprocessor performs the specified operation, such as
arithmetic, logic, or data transfer. Data may be read from or written to memory or
registers as needed.
4. Memory Write Cycle (T4): This cycle is optional and is only executed if the instruction
involves writing data back to memory. During this cycle, the microprocessor writes
the result of the operation back to memory.
The following is an example of the instruction cycle for the MOV A, B instruction:
(i). The microprocessor fetches the MOV A, B instruction from the memory location
pointed to by the PC.
(iii) The microprocessor executes the MOV A, B instruction by moving the contents
of register B to register A.
(iv) The microprocessor does not need to store the result of the execution, because
the result is already stored in register A.
MACHINE CYCLE
The machine cycle is the time it takes for a computer's central processing unit (CPU)
to execute a single machine language instruction. It's also known as the instruction
cycle. The 8085 microprocessor has seven basic machine cycles:
Interrupt acknowledge
Bus idle
T-STATES IN 8085
In the context of the 8085 microprocessor, T-states, short for "Time States," refer to
the individual clock cycles or time intervals within a machine cycle. T-states are used
to precisely measure the execution time of instructions and operations in the
microprocessor. Each machine cycle consists of a specific number of T-states, and
the total number of T-states required for an instruction determines its execution time
Instruction T-states
MOV A, B 3
MOV B, A 3
ADD A, B 4
SUB A, B 4
MUL B 10
DIV B 24
JMP 2000H 10
CALL 2000H 17
MEMORY INTERFACING
1. Select the memory devices: The first step is to select the memory devices that
will be used with the microprocessor. The most common memory devices
used with the 8085 microprocessor are ROM, RAM, and EPROM.
2. Determine the memory map: The next step is to determine the memory map.
The memory map is a table that shows the addresses of the different memory
devices in the system.
3. Connect the memory devices to the microprocessor: Once the memory map
has been determined, the memory devices can be connected to the
microprocessor. The address bus, data bus, and control signals are
connected to the memory devices.
4. Test the memory interface: Once the memory devices have been connected,
the memory interface should be tested to make sure that it is working
properly. This can be done by writing data to memory and then reading it back
to verify that the data is correct.
ASSEMBLY LANGUAGE PROGRAMMING BASICS
Assembly language programs are written using a text editor. The assembly language
program is then compiled into a machine code program that can be executed by the
8085 microprocessor.
Assembly language programs also use labels to identify memory locations and
instructions. Labels are symbolic names that are assigned to memory locations and
instructions. For example, the following code shows how to use a label to identify a
memory location:
START: MOV A, 5
HLT
The label START is assigned to the memory location where the MOV instruction is
located.
Assembly language programs are typically divided into two sections: the data section
and the code section. The data section contains the data that will be used by the
program. The code section contains the instructions that will be executed by the
program.
START: MOV A, 5
ADD B
HLT
This program contains two instructions: MOV A, 5 and ADD B. The MOV instruction
moves the value 5 into register A. The ADD instruction adds the contents of register
B to register A. The HLT instruction halts the microprocessor.
1. LXI H, 2501H : "Get address of first number in H-L pair. Now H-L points to 250
1H"
2. MOV A, M : "Get first operand in accumulator"
3. INX H : "Increment content of H-L pair. Now, H-L points 2502H"
4. ADD M : "Add first and second operand"
5. INX H : "H-L points 4002H"
6. MOV M, A : "Store result at 2503H"
7. HLT : "Stop"
** Instructions can also be classified based on their length. The 8085 microprocessor
has three types of instructions:
1-byte instructions: These instructions are 1 byte long.
2-byte instructions: These instructions are 2 bytes long.
3-byte instructions: These instructions are 3 bytes long.
The length of an instruction depends on the number of operands that the instruction
takes. For example, the MOV A, B instruction is a 1-byte instruction because it takes
two operands: register A and register B.
ADDRESSING MODES
Addressing modes are the rules and techniques used by processors to calculate the
memory address or operand location for data operations. They define how
instructions specify the source or destination of data within the system's memory or
registers.
INSTRUCTION SET
An instruction set is a set of instructions that a microprocessor can understand. Instructions
are commands that tell the microprocessor what to do. The instruction set is defined by the
microprocessor's architecture.
The instruction set for a microprocessor is typically divided into several categories, such as:
Data transfer instructions: These instructions move data between registers, memory,
and I/O devices.
Arithmetic instructions: These instructions perform arithmetic operations on data,
such as addition, subtraction, multiplication, and division.
Logical instructions: These instructions perform logical operations on data, such as
AND, OR, and XOR.
Control flow instructions: These instructions change the flow of execution of a
program, such as jumps, calls, and returns.
The size and complexity of the instruction set varies depending on the microprocessor.
Some microprocessors have a small instruction set, while others have a large and complex
instruction set.
INSTRUCTIONS ANS DATA FORMAT
Instructions and data formats are two fundamental concepts in computer
architecture.
Instructions are the commands that tell a computer what to do. They are written in a
machine code language that is specific to the computer's processor. Instructions are
typically divided into two parts: the opcode and the operands. The opcode specifies
the operation to be performed, and the operands specify the data to be operated on.
Data formats are the ways in which data is represented in computer memory.
Common data formats include integers, floating-point numbers, characters, and
strings. Data formats are important because they determine how data can be
manipulated and used by computer programs.
The following table shows some examples of instructions and data formats:
Data
Instruction Description
format
Instructions and data formats are essential for understanding how computers work.
By understanding the different types of instructions and data formats, programmers
can write more efficient and reliable code.
Here are some additional details about instructions and data formats:
Instructions can be simple or complex. Simple instructions, such as ADD A, B,
typically perform a single operation on two operands. Complex instructions,
such as MUL A, B, may perform multiple operations on multiple operands.
The instruction set and data formats of a computer are determined by its
processor. Different processors have different instruction sets and data
formats.
Programmers must use the correct instruction set and data formats when
writing programs for a particular computer. If a programmer uses the wrong
instruction set or data format, the program will not work correctly.
Debugging is the process of finding and removing errors, or bugs, in a program. The goal of
debugging is to identify and correct the root cause of an error. Debugging is an important part
of software engineering because bugs can cause a software system to malfunction.
The process of debugging involves:
Identifying the bug
In the 8085 microprocessor, the stack and subroutines play crucial roles in
organizing and controlling program execution. They are essential for managing the
flow of control and preserving the state of the program during subroutine calls and
returns. Here's an explanation of how stacks and subroutines work in the 8085
microprocessor:
1. Stack:
The stack is a region of memory reserved for storing data temporarily during
program execution.
In the 8085 microprocessor, the stack operates as a "Last-In, First-Out"
(LIFO) data structure, meaning that the most recently pushed data is the first
to be popped off the stack.
The stack in the 8085 is typically implemented using a portion of memory
addresses, with a stack pointer (SP) register used to keep track of the current
top of the stack.
Stack operations involve pushing data onto the stack and popping data off the
stack. The stack pointer is incremented or decremented accordingly.
Instructions related to stack operations in the 8085 include PUSH, POP,
XTHL (Exchange Stack Pointer with HL), and SPHL (Load Stack Pointer from
HL).
2. Subroutines: