BE 3rd Year 6th Sem 221343107009
Practical:1
Aim: Study Practical:8085 Programming Model.
➢ features of 8085 microprocessor.
• It is an 8 bit microprocessor.
• It is manufactured with N-MOS technology.
• It has 16-bit address bus and hence can address up to 216 = 65536 bytes (64KB) memory locations
through A0-A15
• The first 8 lines of address bus and 8 lines of data bus are multiplexed AD0 – AD7
• Data bus is a group of 8 lines D0 – D7
• It supports external interrupt request.
• A 16 bit program counters (PC)
• A 16 bit stack pointer (SP)
• Six 8-bit general purpose register arranged in pairs: BC, DE, HL.
• It requires a signal +5V power supply and operates at 3.2 MHZ single phase clock.
• It is enclosed with 40 pins DIP (Dual in line package).
PIET/CE/MI-2024 1
BE 3rd Year 6th Sem 221343107009
Register Unit : General Purpose Data Register
• 8085 has six general purpose data registers to store 8-bit data.
• These registers are named as B, C, D, E, H and L as shown in fig. 1.
• The user can use these registers to store or copy a data temporarily during the execution of a program by
using data transfer instructions.
• These registers are of 8 bits but whenever the microprocessor has to handle 16-bit data, these registers
can be combined as register pairs – BC, DE and HL.
• There are two internal registers – W and X. These registers are only for internal operation like execution
of CALL and XCHG instructions and not available to the user.
Program Counter (PC)
• 16-bit register deals with sequencing the execution of instructions.
• This register is a memory pointer.
• Memory locations have 16-bit addresses which are why this is a 16-bit register.
• The microprocessor uses this register to sequence the execution of the instructions.
• The function of the program counter is to point to the memory address from which the next byte is to be
fetched.
• When a byte (machine code) is being fetched, the program counter is incremented by one to point to
the next memory location.
Stack Pointer (SP)
• SP is also a 16-bit register used as a memory pointer.
• It points to a memory location in R/W memory, called the stack.
• The beginning of the stack is defined by loading 16-bit address in the stack pointer.
MUX/DEMUX unit
• This unit is used to select a register out of all the available registers.
• This unit behaves as a MUX when data is going from the register to the internal data bus.
• It behaves as a DEMUX when data is coming to a register from the internal data bus of the
microprocessor.
• The register select will behave as the function selection lines of the MUX/DEMUX.
Address Buffer Register & Data/Address Buffer Register
• These registers hold the address/data, received from PC/internal data bus and then load the external
address and data buses.
• These registers actually behave as the buffer stage between the microprocessor and external system
buses.
PIET/CE/MI-2024 2
BE 3rd Year 6th Sem 221343107009
Control Unit:
• The control unit generates signals within microprocessor to carry out the instruction, which has been
decoded.
• In reality it causes connections between blocks of the microprocessor to be opened or closed, so that
the data goes where it is required and the ALU operations occur.
• The control unit itself consists of three parts; the instruction registers (IR), instruction decoder and
machine cycle encoder and timing and control unit.
Instruction Register
• This register holds the machine code of the instruction.
• When microprocessor executes a program it reads the opcode from the memory, this opcode is stored in
the instruction register.
Instruction Decoder & Machine Cycle Encoder
• The IR sends the machine code to this unit.
• This unit, as its name suggests, decodes the opcode and finds out what is to be done in response of the
coming opcode and how many machine cycles are required to execute this instruction.
Timing & Control unit
• The control unit generates signals within microprocessor to carry out the instruction, which has been
decoded.
• In reality, it causes certain connections between blocks of the microprocessor to be opened or closed, so
that the data goes where it is required and the ALU operations occur.
Arithmetic & Logical Unit:
• The ALU performs the actual numerical and logical operation such as ‘add’, ‘subtract’, ‘AND’, ‘OR’,
etc.
• ALU uses data from memory and from accumulator to perform the arithmetic operations and always
stores the result of the operation in accumulator.
• ALU consists of accumulator, flag register and temporary register.
Accumulator
• The accumulator is an 8-bit register that is a part of ALU.
• This register is used to store 8-bit data and perform arithmetical and logical operations.
• The result of an operation is stored in the accumulator.
• It is also identified as register A.
Interrupt Control
• The interrupt control unit has 5 interrupt inputs TRAP,RST 7.5, RST 6.5, RST 5.5 & INTR and one
acknowledge signal INTA
Serial IO control
PIET/CE/MI-2024 3
BE 3rd Year 6th Sem 221343107009
• 8085 serial IO control provides two lines, SOD and SID for serial communication.
• The serial output data (SOD) line is used to send data serially and serial input data line (SID) is used to
receive data serially.
Flags Registers in 8085
• Flag register includes five flip-flops, which are set or reset after an operation according to the data
conditions of the result in the accumulator and other registers.
• They are called zero (Z), carry (CY), sign (S), parity (P) and auxiliary carry (AC) flags; their bit positions
in the flag register are shown in fig.
Figure: Flags registers in 8085
• The microprocessor uses these flags to set and test data conditions..
• The flags are stored in the 8-bit register so that the programmer can examine these flags by accessing
the register through an instruction.
• These flags have critical importance in the decision-making process of the microprocessor.
• The conditions (set or reset) of the flags are tested through the software instructions.
• For instance, JC (jump on carry) is implemented to change the sequence of a program when CY flag is
set.
Z (Zero) Flag:This flag indicates whether the result of mathematical or logical operation is zero or not. If the
result of the current operation is zero, then this flag will be set, otherwise reset.
CY (Carry) Flag: This flag indicates, whether, during an addition or subtraction operation, carry or borrow is
generated or not, if generated then this flag bit will be set.
AC (Auxiliary Carry) Flag: It shows carry propagation from D3 position to D4 position.
S (Sign) Flag: Sign flag indicates whether the result of a mathematical operation is negative or positive. If the
result is positive, then this flag will reset and if the result is negative this flag will be [Link] bit, in fact, is a
replica of the D7 bit.
P (Parity) Flag:Parity is the number of 1’s in a number. If the number of 1’s in a number is even then that
number is known as even parity number. If the number of 1’s in a number is odd then that number is known as
an odd parity number. This flag indicates whether the current result is of even parity (set) or of odd parity
PIET/CE/MI-2024 4
BE 3rd Year 6th Sem 221343107009
Practical:2
Aim: Study Practical: 8085 Instruction Set.
Data Transfer Group
1. MOV r1, r2
Move Data; Move the content of the one register to another.[r1] <-- [r2]
2. MOV r, m
Move the content of memory register. r <-- [M]
3. MOV M, r.
Move the content of register to memory. M <-- [r]
4. MVI r, data.
Move immediate data to register. [r] <-- data.
5. MVI M, data.
Move immediate data to memory. M <-- data.
6. LXI rp, data 16.
Load register pair immediate. [rp] <-- data 16 bits,
[rh]<-- 8 LSBs of data.
7. LDA addr.
Load Accumulator direct. [A] <-- [addr].
8. STA addr.
Store accumulator direct. [addr] <-- [A].
9. LHLD addr.
Load H-L pair direct. [L] <-- [addr], [H] <-- [addr+1].
10. SHLD addr.
Store H-L pair direct. [addr] <-- [L], [addr+1] <-- [H].
11. LDAX rp.
LOAD accumulator indirect. [A] <-- [[rp]]
12. STAX rp.
Store accumulator indirect. [[rp]] <-- [A].
13. XCHG.
Exchange the contents of H-L with D-E pair. [H-L] <--> [D-E]
Arithmetic Group
1. ADD r.
Add register to accumulator. [A] <-- [A] + [r].
2. ADD M.
Add memory to accumulator. [A] <-- [A] + [[H-L]].
3. ADC r.
Add register with carry to accumulator. [A] <-- [A] + [r] + [CS].
4. ADC M.
Add memory with carry to accumulator
PIET/CE/MI-2024 5
BE 3rd Year 6th Sem 221343107009
[A] <-- [A] + [[H-L]] [CS].
5. ADI data
Add immediate data to accumulator. [A] <-- [A] + data.
6. ACI data
Add with carry immediate data to accumulator.
[A] <-- [A] + data + [CS].
7. DAD rp.
Add register paid to H-L pair. [H-L] <-- [H-L] + [rp].
8. SUB r.
Subtract register from accumulator. [A] <-- [A] – [r].
9. SUB M.
Subtract memory from accumulator. [A] <-- [A] – [[H-L]].
10. SBB r.
Subtract register from accumulator with borrow.
[A] <-- [A] – [r] – [CS].
11. SBB M.
Subtract memory from accumulator with borrow.
[A] <-- [A] – [[H-L]] – [CS].
12. SUI data.
Subtract immediate data from accumulator [A] <-- [A] – data.
13. SBI data.
Subtract immediate data from accumulator with borrow.
[A] <- - [A] – data – [CS].
14. INR r
Increment register content [r] <-- [r] +1.
15. INR M.
Increment memory content [[H-L]] <-- [[H-L]] + 1.
16. DCR r.
Decrement register content). [r] <-- [r] – 1.
17. DCR M.
Decrement memory content) [[H-L]] <-- [[H-L]] – 1.
18. INX rp.
Increment register pair) [rp] <-- [rp] – 1.
19. DCX rp
Decrement register pair) [rp] <-- [rp] -1.
20. DAA : Decimal adjust accumulator.
Logical Group
1. ANA r.
AND register with accumulator. [A] <-- [A] ^ [r].
2. ANA M.
AND memory with accumulator. [A] <-- [A] ^ [[H-L]].
3. ANI data.
PIET/CE/MI-2024 6
BE 3rd Year 6th Sem 221343107009
AND immediate data with accumulator. [A] <-- [A] ^ data.
4. ORA r.
OR register with accumulator. [A] <-- [A] v [r].
5. ORA M.
OR memory with accumulator. [A] <-- [A] v [[H-L]]
6. ORI data.
OR immediate data with accumulator. [A] <-- [A] v data.
7. XRA r.
EXCLUSIVE – OR register with accumulator. [A] <-- [A] v [r]
8. XRA M.
EXCLUSIVE-OR memory with accumulator)
[A] <-- [A] v [[H-L]]
9. XRI data.
EXCLUSIVE-OR immediate data with accumulator
[A] <--[A]
10. CMA.
Complement the accumulator [A] <-- [A]
11. CMC.
Complement the carry status [CS] <-- [CS]
12. STC.
Set carry status. [CS] <-- 1.
13. CMP r.
Compare register with accumulator. [A] – [r]
14. CMP M.
Compare memory with accumulator. [A] – [[H-L]]
15. CPI data.
Compare immediate data with accumulator) [A] – data
16. RLC
Rotate accumulator left
[An+1] <-- [An], [A0] <-- [A7],[CS] <-- [A7].
[Link].
Rotate accumulator right
[A7] <-- [A0], [CS] <-- [A0], [An] <--[An+1].
PIET/CE/MI-2024 7
BE 3rd Year 6th Sem 221343107009
18. RAL.
Rotate accumulator left through carry
[An+1] <-- [An], [CS] <-- [A7], [A0] <-- [CS].
19. RAR.
Rotate accumulator right through carry.
[An] <-- [An+1], [CS] <-- [A0], [A7] <-- [CS]
Branch Group
1. JZ addr (label) : Jump if the result is zero
2. JNZ addr (label) : Jump if the result is not zero
3. JC addr (label) : Jump if there is a carry
4. JNC addr (label) : Jump if there is no carry
5. JP addr (label) : Jump if the result is plus
6. JM addr (label) : Jump if the result is minus
7. JPE addr (label) : Jump if even parity
8. JPO addr (label) : Jump if odd parity
Stack, I/O and Machine Control Group
1. IN port-address: Input to accumulator from I/O port. [A] <-- [Port]
2. OUT port-address: Output from accumulator to I/O port [Port] <-- [A]
3. PUSH rp : Push the content of register pair to stack
4. PUSH PSW : PUSH Processor Status Word
5. POP rp : Pop the content of register pair, which was saved, from the stack
6. POP PSW : Pop Processor Status Word
7. HLT : Halt.
8. XTHL : Exchange stack-top with H-L.
9. SPHL : Move the contents of H-L pair to stack pointer.
10. EI : Enable Interrupts.
11. DI : Disable Interrupts.
12. SIM : Set Interrupt Masks.
13. RIM : Read Interrupt Masks.
14. NOP : No Operation.
PIET/CE/MI-2024 8
BE 3rd Year 6th Sem 221343107009
Practical:3
Aim: Write an 8085 assembly language program to get 05H in register A & move into
register B.
Code:
MVI A,05H
MOV B,A
HLT
Output:
PIET/CE/MI-2024 9
BE 3rd Year 6th Sem 221343107009
Practical:4
Aim: Write an 8085 assembly language program to Load content of memory location
C001H in accumulator then & transfer to register B.
Code:
LXI H,C001H
MVI M,22H
LDA C001H
MOV B,A
HLT
Output:
PIET/CE/MI-2024 10
BE 3rd Year 6th Sem 221343107009
Practical:5
Aim: Write an 8085 assembly language program to store 8-bit data in memory using
direct addressing. And Store 8-bit data in memory using indirect addressing
Code: Store 8-bit data in memory using direct addressing
MVI A, 12H
STA 0006H
HLT
Output:
PIET/CE/MI-2024 11
BE 3rd Year 6th Sem 221343107009
Code: Store 8-bit data in memory using indirect addressing
LXI H,0007H
MVI M,11H
HLT
Output:
PIET/CE/MI-2024 12
BE 3rd Year 6th Sem 221343107009
Practical:6
Aim: Write an 8085 assembly language program to Move 11H in accumulator,
increment it by 1 & store result in memory 0004H.
Code:
MVI A, 11H
INR A
STA 0004H
HLT
Output:
PIET/CE/MI-2024 13
BE 3rd Year 6th Sem 221343107009
Practical:7
Aim: Write an 8085 assembly language program to Implement following arithmetic
operation
a) Addition of two 8 bit numbers
b) Subtraction of two 8 bit numbers
Addition of two 8 bit numbers
Code:
MVI A,04H
MVI B,05H
ADD B
HLT
Output:
PIET/CE/MI-2024 14
BE 3rd Year 6th Sem 221343107009
Subtraction of two 8 bit numbers
MVI A,04H
MVI B,05H
SUB B
HLT
Output:
PIET/CE/MI-2024 15
BE 3rd Year 6th Sem 221343107009
Practical:8
Aim: Write an 8085 assembly language program to Implement following logical
operation
a) AND operation
b) OR operation
c) X-OR operation
d) Complement of given number
AND operation
MVI A,AAH
MVI B,0FH
ANA B
HLT
Output:
PIET/CE/MI-2024 16
BE 3rd Year 6th Sem 221343107009
OR operation
MVI A,AAH
MVI C,2DH
ORA C
HLT
Output:
PIET/CE/MI-2024 17
BE 3rd Year 6th Sem 221343107009
X-OR operation
MVI A,AAH
MVI C,2DH
XRA C
HLT
Output:
PIET/CE/MI-2024 18
BE 3rd Year 6th Sem 221343107009
Complement of given number
MVI A,88H
CMA
HLT
Output:
PIET/CE/MI-2024 19
BE 3rd Year 6th Sem 221343107009
Practical:9
Aim: Write an 8085 assembly language program for exchanging two 8-bit numbers
stored in memory location 1011h and 1012h.
Code:
LDA 1011H
MOV B,A
LDA 1012H
STA 1011H
MOV A,B
STA 1012H
HLT
Input:
PIET/CE/MI-2024 20
BE 3rd Year 6th Sem 221343107009
Output:
PIET/CE/MI-2024 21
BE 3rd Year 6th Sem 221343107009
Practical:10
Aim: Write an assembly language program to find the maximum number out of two
numbers stored in memory locations 2501 H and 2502 H. Store the result in 2503 H
memory location.
Code:
LXI H,2501H
MOV A,M
INX H
CMP M
JNC NEXT
MOV A,M
NEXT: STA 2503H
HLT
Input:
Output:
PIET/CE/MI-2024 22
BE 3rd Year 6th Sem 221343107009
Practical:11
Aim: Write an 8085 assembly language program to implement Addition of 16 bit
numbers
Code:
LXI H,2000H
MVI M,52H
LHLD 2000H
XCHG
LXI H,2002H
MVI M,50H
LHLD 2002
MOV A, E
ADD L
MOV L, A
MOV A, D
ADC H
MOV H, A
SHLD 2004H
HLT
Output:
PIET/CE/MI-2024 23
BE 3rd Year 6th Sem 221343107009
Practical:12
Aim: Write an 8085 assembly language program to get the minimum from block of five
8-bit numbers which store from memory location 8001H to 8005H and final result will
be store in 9000H.
Code:
LXI H,8001H
MOV B,M
MVI C,05
LOOP: INX H
MOV A,M
CMP B
JNC SKIP
MOV B,A
SKIP: DCR C
JNZ LOOP
LXI H,9000H
MOV M,B
HLT
Input:
PIET/CE/MI-2024 24
BE 3rd Year 6th Sem 221343107009
Output:
PIET/CE/MI-2024 25
BE 3rd Year 6th Sem 221343107009
Practical:13
Aim: Write an 8085 assembly language program to arrange an array of data in
descending order. which store from memory location 1001H and size of Array store at
1000H.
Code:
LXI H,1000
MOV C,M
DCR C
REPEAT:MOV D,C
LXI H,1001
LOOP:MOV A,M
INX H
CMP M
JNC SKIP
MOV B,M
MOV M,A
DCX H
MOV M,B
INX H
SKIP:DCR D
JNZ LOOP
DCR C
JNZ REPEAT
HLT
Input:
PIET/CE/MI-2024 26
BE 3rd Year 6th Sem 221343107009
Output:
PIET/CE/MI-2024 27
BE 3rd Year 6th Sem 221343107009
Practical:14
Aim: Write an 8085 assembly language program to convert two BCD numbers in
memory to the equivalent HEX number using 8085 instruction set.
Code:
LXI H,4150
MOV A,M
ADD A
MOV B,A
ADD A
ADD A
ADD B
INX H
ADD M
INX H
MOV M,A
HLT
Input:
Output:
PIET/CE/MI-2024 28
BE 3rd Year 6th Sem 221343107009
Practical:15
Aim: Write an 8085 assembly language program to convert given Hexa decimal number
into its equivalent BCD number using 8085 instruction set.
Code:
LXI H,4150
MVI D,00
XRA A
MOV C,M
LOOP2: ADI 01
DAA
JNC LOOP1
INR D
LOOP1: DCR C
JNZ LOOP2
STA 4151
MOV A,D
STA 4152
HLT
Input:
Output:
PIET/CE/MI-2024 29