0% found this document useful (0 votes)
18 views

unit-4_CA_updated_Notes

Notess
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

unit-4_CA_updated_Notes

Notess
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

What is Microprocessor?

 The computer’s Central Processing Unit (CPU) built on a single Integrated Circuit
(IC) is called a microprocessor.

 It is a programmable, multipurpose, clock-driven, register-based electronic


device that reads binary instructions from a storage device called memory,
accepts binary data as input, & processes data according to those instructions,
and provides results as output.

The microprocessor contains millions of tiny components like transistors, registers,


and diodes that work together.

Micro computer:

 A digital computer with one microprocessor which acts as a CPU is called a


microcomputer.

Block Diagram of a Microcomputer

This diagram represents a traditional CPU setup where the main components are
separated.
1. Arithmetic /Logic unit (ALU): It is responsible for performing arithmetic and
logical operations.
2. Control unit: Manages the execution of instructions by controlling data flow.
3. Memory: Stores instructions and data that are processed by the CPU.
4. Input and Output: Handles communication between the CPU and external
devices.
Components of a Microprocessor
A microprocessor consists of various components that work together to execute
instructions:
1. Arithmetic Logic Unit (ALU): This is the component responsible for performing
arithmetic (addition, subtraction, multiplication, division) and logical
operations (AND, OR, NOT) The ALU is the computational heart of the
microprocessor.
2. Control Unit: The control unit manages the execution of instructions by directing
the flow of data between the microprocessor, memory, and I/O devices.
3. Registers: Registers are small, fast storage locations within the CPU. They are
used to temporarily hold data, instructions, or addresses during execution.
Registers are much faster than external memory like RAM.
* Data Registers: Hold intermediate results or operands for calculations.
* Address Registers: Hold memory addresses for instructions or data.
* Program Counter (PC): Keeps track of the next instruction to execute.
* Stack Pointer (SP): Points to the top of the stack, which is used for function
calls and handling interrupts.
4. Buses: The microprocessor communicates with memory and 1/0 devices through
buses These are electrical pathways used to transmit data, addresses, and control
signals.
o Data Bus: Carries the actual data being processed.
o Address Bus: Carries the memory addresses where data is stored.
o Control Bus: Carries signals like read/write operations to control the
flow of data.

How a microprocessor works:


A microprocessor operates based on the fetch-decode-execute cycle, which consists of
the following stages.
1. Fetch: The microprocessor retrieves an instruction from memory, using the
address stored in the program counter (PC). The instruction is stored in the
instruction register.
2. Decode: The control unit decodes the instruction to determine what operation
needs to be performed (e.g., addition, subtraction, data transfer).
3. Execute: The ALU or other parts of the processor execute the instruction. This
might involve performing arithmetic, logical operations, or transferring data between
registers and memory.
4. Store/Update: After execution, the result is stored in a register or memory. The
program counter is then updated to point to the next instruction in memory.

Evolution of Microprocessor:
 The first generation microprocessors were introduced in the year 1971-1972 by
Intel Corporation. It was named Intel 4004 since it was a 4-bit processor.
 The second generation microprocessors were introduced in 1973 again by Intel.
It was a first 8 - bit microprocessor which could perform arithmetic and logic
operations on 8-bit words. It was Intel 8008, and another improved version was
Intel 8088.
 The third generation microprocessors, introduced in 1978 were represented
by Intel's 8086, Zilog Z800 and 80286, which were 16 - bit processors with a
performance like minicomputers.
Several different companies introduced the 32-bit microprocessors, but the most
popular one is the Intel 80386.
Basic Terms used in Microprocessor
 Instruction Set - The group of commands that the microprocessor can
understand is called Instruction set. It is an interface between hardware and
software.
 Bus - Set of conductors intended to transmit data, address or control
information to different elements in a microprocessor. A microprocessor will
have three types of buses, i.e., data bus, address bus, and control bus.
 IPC (Instructions per Cycle) - It is a measure of how many instructions a CPU is
capable of executing in a single clock.
 Clock Speed - It is the number of operations per second the processor can
perform. It can be expressed in megahertz (MHz) or gigahertz (GHz). It is also
called the Clock Rate.
 Bandwidth - The number of bits processed in a single instruction is called
Bandwidth.
 Word Length - The number of bits the processor can process at a time is called
the word length of the processor. 8-bit Microprocessor may process 8 -bit data
at a time. The range of word length is from 4 bits to 64 bits depending upon the
type of the microcomputer.
 Data Types - The microprocessor supports multiple data type formats like
binary, ASCII, signed and unsigned numbers.
Features of a Microprocessor:
 High Speed: They execute instructions rapidly, enabling quick processing of data
and tasks.
 Small Size: Microprocessors are compact, allowing them to fit into a variety of
devices and systems.
 Versatile: They can be programmed to perform a wide range of functions,
making them suitable for diverse applications.
 Low Power Consumption: Designed to operate efficiently, microprocessors
consume minimal power, extending battery life and reducing energy costs.
 Less Heat Generation: They produce less heat compared to older technologies,
minimizing the need for extensive cooling solutions.
 Reliable: Microprocessors offer consistent performance and durability,
contributing to the overall stability of electronic systems.
 Portable: Their small size and low power requirements make them ideal for use
in portable and mobile devices.

Introduction to 8085 Microprocessor:


The 8085 microprocessor is an 8-bit microprocessor. This means it can process 8
bits of data at a time. It has a 16-bit address bus, which allows it to access 64KB
of memory. The 8085 is a general-purpose microprocessor. It includes a variety
of instructions for performing arithmetic, logic, and control operations. This
microprocessor commonly used in early computers, control systems and
embedded devices.
The key features (or) characteristics of 8085 microprocessor are:

8-bit Data Width: The 8085 can handle data in 8-bit chunks. It is suitable for
simple and small-scale computing tasks.
16-bit Address Bus: It can access up to 64KB of memory. This memory capacity
was sufficient for most early computing and control applications. • Clock Speed:
The 8085 operates at a clock speed of up to 3.2 MHZ. It provided fast
performance in that period.
5V Power Supply: The microprocessor operates using a single 5V power supply.
This makes it easy to power and integrate into various systems.
74 Instructions: The instruction set includes 74 instructions. These cover data
transfer, arithmetic, logic, branching, and control operations. The 8085 is an 8-bit
device and hence it can have up to 28 = 256 instructions. However, the 8085 only
uses 246 combinations that represent a total of 74 instructions.
Multiplexed Address/Data Bus: The 8085 uses a multiplexed bus for both
address and data. This helps to reduce the number of external pins required. The
term multiplexed bus refers to using the same set of lines (or wires) to carry both
address and data at different times.
Internal Registers: It contains six 8-bit registers (B, C, D, E, H, L), a 16-bit stack
pointer, and a 16-bit program counter for efficient operation.
Interrupt System: The 8085 has five hardware interrupts. This allows fast
responses to external events.

8085 Microprocessor Architecture

The 8085 microprocessor architecture has the following essential components:

 Arithmetic and Logic unit


 Register Section(Register array)
 Instruction Register and decoder
 Timing and control unit
 Serial Input /Output Control
 Interrupt Control
 Address Bus and Address / Data Bus

1. Register Array:
General purpose Registers: The 8085 has 6 general purpose registers to store 8-bit
data during program execution. These 6 registers are identified as B, C, D, E, H and L.
They can be combined as register pairs BC, DE and HL to perform some 16-bit
operations. These registers are programmable. It can use to load or transfer data from
the registers by using instructions.
Stack Pointer (SP): The stack pointer is also a 16-bit register, used as a memory
pointer. It points to a memory location in R/W memory, called stack. The stack is used
to store return addresses during subroutine calls, as well as local variables and other
data.
Program counter: It is a 16-bit register used to store the memory address location of
the next instruction to be executed.
Incrementer / Decrementer address latch: This 16-bit register is used to increment or
decrement the contents of program counter or stack pointer.

2. Arithmetic and Logic unit:


The Arithmetic logic unit is responsible for performing all arithmetic and
logical operations. It works closely with the accumulator and other registers to execute
operations like addition, Subtraction, AND, OR, and NOT. ALU performs operations
on data that is stored in registers, particularly the accumulator.
Accumulator: The accumulator (A) is an 8-bit register that is part of ALU. It is used to
store 8-bit data and to perform ALU operations. It holds one of the operands during
ALU Operations and the final result of ALU operations is also placed in the
accumulator.
Temporary register: It is an 8-bit register; this register temporarily holds data during
operations.
Flag register: A flag is a filp-flop indicates some conditions which arise after the
execution of arithmetic and logical operations. It is an 8-bit register having five 1-bit
flip-flops, which holds either 0 or 1 depending upon the result stored in the
accumulator and other registers and remaining are undefined and value is always 0.
These are the set of 5 flip-flops
1. Sign (S)
2. Zero (Z)
3. Auxiliary Carry (AC)
4. Parity (P)
5. Carry (C)

Carry Flag (C): Set if there is a carry or borrow during arithmetic operations.
Zero Flag (Z): Set if the result of an operation is 00H in Accumulator register.
Sign Flag (S): S=1 if D7 bit of the A is 1(indicate the result is - ve)
S= 0 if D7 bit of the A is 0(indicate the result is +ve)
Parity Flag (P): P= 1; if the result of an ALU operation has an even number of 1’s in A;
P= 0; if number of 1 is odd.
Auxiliary Carry Flag (AC): Similar to CY,
AC= 1 if there is a carry from D3 to D4 Bit
AC= 0 if there is a no carry from D3 to D4 Bit

3. Instruction Register and decoder


Instruction register and decoder: It is an 8-bit register. The instruction register and
decoder are part of the ALU. When an instruction is fetched from the memory it is
loaded in to the instruction register. It holds the operation code of the instruction which
is being decoded by the decoder and executed.

4. Serial Input /Output Control


Serial Input/output control: It controls the serial data communication by using these
two instructions: SID (Serial input data) and SOD (Serial output data).
SID: It is used to receive serial data one bit at a time. This is a single bit input line.
SOD: It is used to send serial data one bit at a time. This is a single bit output line.
5. Interrupt Control
Interrupt control: It controls the interrupts during a process. Which are signals that
temporarily halt then microprocessors current operations to give attention to more
urgent tasks? Interrupts are essentially requests from external devices (like keyboards,
sensors,) for the microprocessors to momentarily stop what its doing and attend to
the new task.
Or when a microprocessor is executing a main program and whenever an interrupt
occurs, the microprocessor shifts the control from the main program to process the
incoming request. After the request is completed, the control goes back to the main
program. There are 5 interrupt signals in 8085 microprocessor: INTR, RST 7.5, RST 6.5,
RST 5.5, and TRAP.
INTR: A maskable interrupt that can be enabled or disabled by the processor, allowing
for flexible interrupt handling.
RST5.5, RST 6.5 & RST 7.5 are maskable vectored interrupts. This can specify the
predefined memory addresses in the micro processors memory space.
TRAP: A high-priority, non-maskable interrupt that is used for critical errors or events
requiring immediate attention.

6. Address Bus and Address / Data Bus


Address Buffer: This is an 8-bit unidirectional buffer. It is used to drive external high
order address bus (A15 – A8). When it is not used under such as reset, hold and halt
etc this buffer is used tristate high order address bus.
Address/Data Buffer: This is an 8-bit bi-directional buffer. It is used to drive multiplexed
address/data bus. i.e., lower order address bus (A7-A0) and data bus (D7-D0). Under
certain conditions such as reset, hold and halt etc this buffer is used tristate low order
address bus.

7. Timing and control unit


It is used to generate the timing and control signals which are necessary for the
execution of instructions. It is used to control the data flow between the CPU and
peripherals (Including Memory).it is used to control the entire operations of the micro
processor and peripherals connected to it.
Following are the timing and control signals, which control external and internal
circuits −
Control Signals: READY, RD’, WR’, ALE
Status Signals: S0, S1, IO/M’
DMA Signals: HOLD, HLDA
RESET Signals: RESET IN, RESET OUT
Control Signals: RD’, WR’, ALE
 ALE is used for provide control signal to synchronize the components of
microprocessor and timing for instruction to perform the operation.
 RD (Active low) and WR (Active low) are used to indicate whether the
operation is reading the data from memory or writing the data into memory
respectively.
 Status Signals: S0, S1, IO/M’
 IO/M (Active low) is used to indicate whether the operation belongs to the
memory or peripherals.

 RESET IN − This signal is used to reset the microprocessor by setting the


program counter to zero.
 RESET OUT − This signal is used to reset all the connected devices when the
microprocessor is reset.
 READY − This signal indicates that the device is ready to send or receive data. If
READY is low, then the CPU has to wait for READY to go high.
 HOLD − This signal indicates that another master is requesting the use of the
address and data buses.
 HLDA (HOLD Acknowledge) − It indicates that the CPU has received the HOLD
request and it will relinquish the bus in the next clock cycle. HLDA is set to low after
the HOLD signal is removed.
8085 Pin Configurations:

The 8085 is an 8-bit general purpose microprocessor capable of addressing 64 k of


Memory. This device has 40 pins requires a +5 V power supply and can operate
with a 3 MHz single phase clock. The above figure shows the logic pin-out of the
8085 microprocessor.
All the signals are classified into 7 groups:
 Address bus
 Data bus
 Control & status signals
 Power supply and frequency signals
 Externally initiated signals
 Serial I/O signals
 Interrupt signals
 Address Bus: The 8085 has 8 signal lines from A8 – A15 which are
unidirectional and used as higher order address bus.
 Multiplexed Address & Data bus: The signal lines from AD7 – AD0 are
bidirectional, they serve for a dual purpose. They are used as the lower order
address bus as well as the data bus.
 Control Pins – RD, WR, IO/M(active low)

RD: Read (Active low) (Pin 32)


It indicates that the data bus is ready for accepting data from
the memory or I/O device.
WR: Write (Active low) (Pin 31)
It indicates that data on the data bus are to be written into
selected memory or I/O device.
IO/M: (Input Output/Memory-Active low) (Pin 34)
Signal specifies that the read/write operation relates to whether
memory or I/O device.
When (IO/M=1) the address on the address bus is for I/O device
When (IO/M=0) the address on the address bus is for memory

IO/M(active low) RD WR Control Signal Operation


0 0 1 MEMR M/M Read
0 1 0 MEMW M/M write
1 0 1 IOR I/O Read
1 1 0 IOW I/O Write

Address latch enable:


o It helps separate the address and data on the same set of wires
(called AD0 – AD7 lines).
 How it works:
 When ALE is high (1), it means the AD lines are carrying
address information.
 When ALE is low (0), it means the AD lines are carrying data.
 S1 and S0 (Status Signal): (Pin 33 and 29)
o Status signals to specify the kind of operation being performed usually un-
used in small systems.

Operation S1 S0
HALT 0 0
WRITE 0 1
READ 1 0
FETCH 1 1

Interrupt and Serial I/O Pins


* INTR (Interrupt Request): It is used by external devices to request an Interrupt.
* INTA (Interrupt Acknowledge): It is used to acknowledge an interrupt request.
TRAP: It is a non-maskable interrupt with the highest priority
RST 7.5, RST 6.5, and RST 5.5: Pins 7, 8 and 9 are maskable, vectored interrupts
SID (Serial Input Data): It is used for serial input.
SOD (Serial Output Data): It is used for serial output.

Control Pins
READY: It checks if a peripheral device is ready to communicate with the
microprocessor. If not, the microprocessor waits.
HOLD: It is used to indicate that an external device is requesting control of the bus
HLDA (Hold Acknowledge): It is used to acknowledge a HOLD request.
RESET IN: It is used to reset the microprocessor and start the program execution from the
beginning.
RESET OUT: It indicates to external devices that the microprocessor has been reset.
CLK OUT: It provides the clock signal for external devices.

XTAL1 and XTAL2: These pins are used to connect an external crystal oscillator that
provides the clock signal for the microprocessor.
VCC: It is used to provide a 5V power supply to the microprocessor.
GND: It is the Ground Pin.
Programming model of 8085:

1. Arithmetic and Logic Unit (ALU): The ALU is where the microprocessor performs
all arithmetic (Addition, subtraction) and logical (AND, OR, NOT) operations.
Accumulator: The Accumulator is an 8-bit register. It stores the Intermediate
results of Arithmetic and Logical operations. It holds first operand of ALU
Operations and the final result of ALU operations is also placed in the
accumulator.
Flags: The flag register consists of 5 flip-flops that reflect the outcome of ALU
operations. These flags are Zero (Z), Sign (S), Carry (CY), Parity (P), and Auxiliary
Carry (AC). Ex example: if the result of an addition is ZERO, the Zero flag is set.
Instruction Decoder: The instruction decoder decodes the instructions fetched
from memory. It identifies what operations perform and sends controls signals to
appropriate components of the microprocessor.
2. Register section: This section contains the General Purpose registers, Stack
pointer and Program counter. These registers store data and addresses
temporarily while the micro processor is performing operations.
Register array: The 8085 has six 8-bit general purpose registers (B, C, D, E, H, L ) .
These registers are used to store data temporarily and can be combined to from
register pairs (BC, DE, and HL) to handle 16-bit data.
Memory pointer Register: This includes the Program counter (PC) and Stack
pointer (SP) which are 16-bit registers. The PC holds the memory address of the
next instruction to be executed. The SP points to the top of the stack in memory,
the stack is used to store return addresses during subroutine calls or Interrupts.
3. Timing and Control Unit: It is used to generate the timing and control signals
which are necessary for the execution of instructions. It is used to control the
data flow between the CPU and peripherals (Including Memory).it is used to
control the entire operations of the micro processor and peripherals connected
to it.
Following are the timing and control signals, which control external and internal
circuits −
Control Signals: READY, RD’, WR’, ALE
Status Signals: S0, S1, IO/M’
DMA Signals: HOLD, HLDA
RESET Signals: RESET IN, RESET OUT
4. Buses: Buses are used to Transfer data, address and control signals between the
micro processor and the other components.
16-bit address Bus: This is unidirectional bus that carries the 16 bit memory
address from the microprocessor to memory or I/O devices.
8-bit address Bus: This is a bidirectional bus that transfers 8 bits of data
between the microprocessor and memory or I/O devices.

Addressing Modes of 8085:


Addressing modes are techniques used by instructions to specify the data
that are required for their operations. The data can be located in registers,
Memory locations, or directly with in the instructions.
1. Direct Addressing Mode
2. Immediate Addressing Mode
3. Register Addressing Mode
4. Register Indirect Addressing Mode
5. Implied addressing Mode
1. Direct Addressing Mode: In this Mode the address of the data
(operand) is explicitly mentioned in the instruction itself. The
microprocessor uses this address to access the data directly. In direct
addressing Mode all the instructions are 3 Byte instructions expect IN
and OUT instructions.
Ex: STA 9000H Store the content of Accumulator in Memory location
9000H.
LDA 2050H Load Accumulator with the data of Specified location
2050H.
2. Immediate Addressing Mode: In this mode the operand (data) is
provided directly with in the instruction itself. The data is immediately
available for the operation.
EX: MVI A, 50H Move the value 50H directly into the accumulator.
ADI 65H Add the value 65H to the content of the Accumulator.
3. Register addressing Mode: In register addressing the data is located
in one of the general purpose registers of the 8085 micro processor.
The instruction Specifies which register contains the data.
Ex: MOV A, C Move the contents of register C to the accumulator.
ADD B Add the content of register B to the content of the
Accumulator.
4. Register indirect Addressing mode: In register indirect addressing
mode the Address of the data is stored in a register pair usually (BC,
DE, HL) the instruction uses the content of the register pair to access
the data.
Ex: STAX D Store the contents of the accumulator into the memory
location addressed by the DE register Pair.
MOV A, M Move the Content of the Memory location pointed to by
the DE register pair to the accumulator.
5. Implied addressing Mode: In this addressing mode the instructions
operate on only one operand. These instructions assume that the data
is to be in accumulator. All these instructions are one byte instruction.
EX: CMA Compliments the content of accumulator
RAL Rotate Accumulator Content left.
Instruction Word Size:

The 8085 Micro processor is an 8 bit micro processor and it can handles 8
bit data at a time. If 16 bit data are to stored, they are stored they are
stored in two consecutive Memory locations. The Micro processor
understands the instructions written in binary codes or machine codes.
According to the word length the 8085 instructions are belongs to the one
of the following three groups.
1. One Byte instructions
2. Two Byte instructions
3. Three Byte instructions
One Byte instructions: A 1- Byte Instruction includes the op code and
operand in the same type. Operands are internal register and are coded
into the instruction. This instruction requires one memory location to store
Single byte in Memory.
Ex:
Memory Op Code Operand Hex Task
Address Code
8000H MOV C,A 4FH Copy the content of the
accumulator in the register C.
8001H ADD B 80H Add the content of register B
to the Contents of the
Accumulator.
8002H CMA 2FH Invert (Compliment) each bit
in the accumulator.

Here MOV C, A is stored in 8000H memory locations. Similarly ADD B and


CMA are stored in 8001H and 8002H memory locations. Thus one memory
location is needed to store 1-byte instructions.
2. Two Byte instructions: In a two byte instruction, the first byte specifies
the operation code and the second byte specifies the operand. The
instruction would require two memory locations to store in memory.
For example:

Memory Op Code Operand Hex Code Task


Address
8000H, MVI A, Data 3E (first Byte) Load an 8-bit data byte
8001H Data(Second Byte) in the accumulator

Assume that the Data byte is 32H. The assembly Language instruction is written as

Memory Instruction Hex Code


Address
8000H, 8001H MVI A, 32H 3E (first Byte), 32H(Second Byte)

Note: The hex code of MVI A is stored in 8000H memory location and the data 32H is
stored 8001H memory location. Thus the 2-byte instructions require two memory
locations to store in memory.

3. Three Byte instruction:


In a three-byte instruction, the first byte specifies the opcode, and the following two
bytes specify the 16-bit address. The second byte is the lower order address and the third
byte is the higher order address. The instruction would require three memory locations to
store in memory. Opcode+ data byte data byte

Ex:
Memory Op Operand Hex Code Task
Address Code
8000H, JMP 2050H C3 (first Byte) Transfer the program
8001H, 50 (Second Byte) sequence to the memory
8002H 20 (Third Byte) location 2050H.
8000H, LXIH 2500H 21 (first Byte) Initialize the memory
8001H, 00 (Second Byte) pointer by HL register
8002H 25 (Third Byte) pair.
Instruction Classification of 8085:
An instruction is a binary pattern used by the microprocessor to perform a specific
function. The complete set of instructions that a microprocessor can execute is called the
instruction set.
The instructions are categorized in two ways.
1. Instruction Classification of 8085 based on Functions
2. Instruction Classification of 8085 based on Word Length
Instruction Classification of 8085 based on Functions:
The primary Categories are
1. Data Transfer Instructions
2. Arithmetic operations
3. Logical operations
4. Branching operations
5. Machine Control operations
Data Transfer instructions:
In 8085 microprocessor, data transfer instructions are used to move data between
registers, memory, and I/O ports. These operations allow data to be copied from one
location to another without modifying the contents of the original location.
➢ MOV Data Between Registers and Memory
1.Mov Rd and Rs
This instruction transfers the contents of the source register (Rs) to the destination
register (Rd) without modifying the contents of the source register. Both Rs and Rd can
be any general-purpose registers or the accumulator (B, C, D, E, H, L or A). Since
there are 7 registers, there are a total of 49 combinations of MOV instructions for
transferring data between any two registers. The Possible combinations of MOV
instructions are:
MOV A, B MOV B, A MOV C, A MOV E, B
Ex: MOV B, C
The instruction MOV B, C will copy the contents of C register to register B. The
contents of register B and C before and after execution of the instruction is:
Register Before After
Execution Execution
B 3A 52
C 52 52

2. MOV Rd, M
• This instruction is used to transfer data from a memory location, which is addressed by
the HL register pair, to another register.
• The HL register pair holds the address of the memory location, it contains the
operand(data) that can be moved Specified destination Register (Rd).
Ex: MOV D, M
The HL register pair holds the memory location 8500H. Assume that contents of H and L
are 85 and 00. The contents of the memory location are 23. The MOV D, M instruction
transfers this data (23) to register D.

Register Before After Memory location Memory content


Execution Execution 8500H 23
D 00 23
H 85 85
L 00 00

3. MOV M, Rs
The instruction MOV M, Rs is used to copy the data from specified source register (Rs)
in to the memory location pointed by the HL register pair. The HL register pair is used as
a pointer to determine the specific memory location where the data will be stored. Rs can
be any one of the general-purpose registers or the accumulator.
Ex: MOV M, B
The HL register pair holds the memory location 8050H.Assume the contents of register H and L
are 80 and 50. The contents of the register B (34) is moved to the Memory location.

Register Before After


Execution Execution Memory Before Execution After Execution
B 34 34 location Memory Content Memory
H 80 80 Content
L 50 50 8050H 9F 34
➢ MOV Immediate Data Instructions:
In the 8085 microprocessors, move immediate data Instruction are used to load an
immediate 8-bit value directly into a register or memory location. These instructions are
especially useful for initializing or updating the values in registers or memory locations
with a constant value.
1. MVI Rd, 8 bit-data
• It is used to load an immediate 8-bit data in to a Specified destination
register.
Ex: MVI D,3F
Here the instruction MVI D,3F loads the immediate value 3F in to register D.
2. MVI M,8 bit- data
The instruction MVI M,8 bit-data is used to load an immediate 8-bit data into the
memory location pointed by the HL register pair.
Ex: MVI M,4C
The instruction MVI M,4C loads the Immediate value 4C into the memory
location pointed by HL register pair.

Register Before After Memory Before After


Execution Execution location Execution Execution
H 80 80 Memory Memory
Content Content
L 50 50
8050H 9F 4C
➢ Load Register pair with Immediate Value:
1. LXI Rp,16-bit Data
The instruction LXI Rp, 16-bit data is used to load a 16-bit immediate data into a
register pair (BC, DE, HL). Here Rp can be any one of the register pairs like BC, DE,
HL Or SP. This instruction allows a 16-bit address or value to be stored directly in
the Specified register pair.
Ex: LXI H, 2050H LXI B,2050H LXI D,2050H
In these examples, the instruction LXI H,2050H loads the Immediate 16-bit value
2050H in to the HL register pair. LXI B,2050H loads the Immediate 16-bit value
2050H in to the BC register pair.
Register Before After Register Before After
Execution Execution Execution Execution
H 00 20 B 00 20
L 00 50 C 00 50
➢ Load and store Accumulator:
In the 8085-microprocessor load and store accumulator instructions are used to
transfer data between the accumulator and memory locations.
1. LDA 16-bit Address:
The instruction LDA 16-bit address is used to load the accumulator (A) with
the contents of the Memory location specified by a 16 -bit address.
Ex: LDA 3050H In this Example The instruction LDA 3050H loads the Contents
of the memory location (3050H) into the Accumulator(A).

Register Before After


Execution Execution Memory Memory
A 00 56 location Content
3050H 56
Before execution Accumulator contains 00. The memory location 3050H
contains the value 7C. After execution the content of memory location 3050H
(7C) is loaded in to accumulator A.
2. STA 16-bit Address:
The instruction STA 16-bit address is used to store the contents of the
accumulator into the memory location specified by a 16-bit address.
Ex: STA 4050H
In this example STA 4050H stores the contents of the Accumulator A into the
memory location Specified by a 16-bit address.

Register Before After Memory Memory


Execution Execution location Content
A 8E 8E 4050H 8E

Accumulator Indirect Data Transfer Instructions.


In the 8085 Microprocessor, the accumulator Indirect Data Transfer Instructions are used
to load or store data between the Accumulator and memory locations indirectly
specified by a register pair (BC Or DE).
1. LDAX Rp (Load Accumulator Indirect)
The LDAX Rp instruction is used to load the contents of memory location pointed
by a register pair (Rp) into the Accumulator(A). The register pair can be either BC,
DE or HL. Here memory address is indirectly provided by the register pair.
Ex: LDAX B Loads the contents of the memory location pointed by register pair BC
into the A.
LDAX D Loads the contents of the memory location pointed by register pair DE
into the A.

Register Before After


Memory Memory
Execution Execution
location Content
B 80 80
8050H 4F
C 50 50
A 00 4F
Here DE register pair holds the 8050H memory address. 8050H contains the value
4F After executing LADX D, the value 4Fis loaded into the Accumulator A.

2. STAX Rp (Store Accumulator Indirect)


The instruction STAX Rp is used to store the Contents of the Accumulator A
into the memory location pointed to by register pair Rp. The register pair Rp
can be either BC or DE. The address to which the data from the accumulator
is to be stored is indirectly provided by the register pair.
STAX B: Stores the contents of the accumulator into the memory location
pointed by the BC register pair.
STAX D: Stores the contents of the accumulator into the memory location
pointed by the DE register pair.

Register Before After


Memory Before After
Execution Execution location Execution Execution
D 80 80 Memory Memory
E 50 50 Content Content
A 7A 7A 8050H 00 7A

The instruction STAX D, which stores the content of the accumulator into the
memory location pointed by DE register pair.DE register contains 8050H memory
location and accumulator contains 7A. 7A stored in to 8050H memory location.
➢ Load and Store H and L Registers:
In the 8085 Microprocessor, Load and Store H and L Registers instructions
are used to move the data between the memory and the HL register pair.
1. LHLD 16-bit Address: (Load H and L direct)
The Instruction LHLD 16-bit address is used to load the content of two
consecutive memory locations into the register pair. It directly transfers
data from a memory location to the H and L registers.
Ex: LHLD 3050H
In this example the instruction loads data from memory locations 3050H
(23) and the data from the next memory location 3051H (45) into
registers L and H respectively. Now the HL register pair contains 2345.
The L gets the lower byte and H gets the higher byte.

Memory Memory Register Before After


location Content Execution Execution
3050 23 H 00 45
3051 45 L 00 23

2. SHLD 16-bit Address: (Store H and L direct)


The SHLD 16-bit address is used to store the contents of the H and L
register into two consecutive memory locations.
Ex: SHLD 4050H
The instruction SHLD 4050H stores the content of register L (2D) at
memory location 4050H. It then stores the content of register H (3B) at
the next memory location, 4051H. The value of registers L and H are
saved into consecutive memory locations.

Register Before After Memory Memory Content


Execution Execution location After execution
H 3B 3B 4050 2D
L 2D 2D 4051 3B
Exchange Registers – XCHG
1. XCHG (Exchange H and L with D and E)
The XCHG instruction is used to exchange the contents of register pairs HL
and DE. This means that the data in the H register is swapped with the data
in the D register, and the data in the L register is swapped with the data in
the E register. This instruction allows you to quickly interchange the values
of these two register pairs without need for additional temporary storage.
which is useful in situations where multiple 16-bit values need to be
manipulated without losing any data.
Ex: XCHG
Assume Register H contains 45, Register L contains 67, Register D contains
34, and register E contains 3B.
o The contents of register H (45) are exchanged with register D (34).
o The contents of register L (67) are exchanged with register E (3B).
o After execution, HL contains the values previously in DE and vice
versa.
Register Before After
Execution Execution
H 45 34
L 67 3B
D 34 45
E 3B 67

You might also like