MI Practical
MI Practical
LAB MANUAL
FOR
6th Semester
8085 Microprocessor:
The 8085 microprocessor has several addressing modes that are used to access memory locations.
Some of the most commonly used addressing modes in the 8085 microprocessor are: The way of
specifying data to be operated by an instruction is called addressing mode.
In immediate addressing mode the source operand is always data. If the data is 8-bit, then the
instruction will be of 2 bytes, if the data is of 16-bit then the instruction will be of 3 bytes.
Example:
LXI H 3050 (load the H-L pair with the operand 3050H immediately).
In register addressing mode, the data to operate is available inside the register(s) and register(s) is
(are) operands.
Examples:
GEC,Daman 1 221423107005
Practical - 1
ADD B (add contents of registers A and B and store the result in register A).
In direct addressing mode, the data to be operated is available inside a memory location and that
memory location is
directly specified as an operand. The operand is directly available in the instruction itself.
Examples:
LHLD address (load contents of 16-bit memory location into H-L register pair)
In register indirect addressing mode, the data to be operated is available inside a memory location and
that memory
Examples:
MOV A, M (move the contents of the memory location pointed by the H-L pair to the accumulator)
In implied/implicit addressing mode the operand is hidden and the data to be operated is available in
the instruction itself.
Examples:
CMA (finds and stores the 1's complement of the contents of accumulator A in A)
● Versatility: The 8085 microprocessor supports several addressing modes, which allows for a
wide range of memory access and manipulation options.
GEC,Daman 2 221423107005
Practical - 1
● Efficient memory usage: Different addressing modes allow for efficient use of memory,
reducing the memory footprint of programs and making the best use of available memory.
● Easy to use: The addressing modes are easy to use, making it simple for programmers to
write and execute complex programs.
● Improved performance: The use of different addressing modes can improve the performance of
programs, as the correct addressing
● Complexity: The various addressing modes can be complex, making it difficult for programmers
to choose the correct mode for a given task.
● Overhead:The use of different addressing modes can result in additional overhead, as the
microprocessor must perform additional operations to access memory.
● Debugging difficulties:Debugging programs that use multiple addressing modes can be difficult,
as the programmer must keep track of the different modes used in each memory access.
● Limitations:The addressing modes are limited by the size of the program counter and the
memory address space, which can impact the performance of large programs.
GEC,Daman 3 221423107005
Practical-2
GEC,Daman 4 221423107005
Practical-2
Arithmetic Instruction:
Arithmetic Instruction is the instruction which performs basic arithmetic operations such as addition,
subtraction and a few more. In an 8085 microprocessor, the destination operand is generally the
accumulator.
Logical Instruction:
Logical instructions are the instructions that perform basic logical operations such as AND, OR, etc. in the
8085 microprocessor, the destination operand is always the accumulator. Here logical operation works on a
bitwise level.
GEC,Daman 5 221423107005
Practical-2
Branching Instruction:
Branching instructions refer to the act of switching execution to a different instruction sequence as a
result of executing a branch instruction.
1. Jump Instructions:
GEC,Daman 6 221423107005
Practical-2
JPE 16-bit address Jumps to the address if parity flag is 1 JPE 2050
JPO Jumps to the address if sign flag is 0 JPO 2050
JM Jumps to the address if sign flag is 1 JM 2050
JP Jumps to the address if sign flag 0 JP 2050
2. Call Instructions:
3. RETURN
GEC,Daman 7 221423107005
Practical-2
DAA Instruction:
The full form of DAA is Decimal Adjust Accumulator and it is used in BCD addition. This instruction can be
used only after addition and it cannot be used stand alone.
✓ If the LS hex digit in A is <= 9 and AC flag is 0, the LS hex digit value will not be altered.
✓ If the LS hex digit is > 9, or if AC flag is set to 1, it adds 6 to the LS hex digit of A. if carry result,
then it increments the MS hex digit if this addition resulted in a carry to the MS digit position. In this
process, the Cy flag will be set to 1 if the MS hex digit was incremented from F to 0.
✔ If the MS hex digit is <= 9 and Cy flag is 0, the MS hex digit will not be altered, and
Cy flag is reset to 0.
✓If the MS hex digit is > 9, or if Cy flag is set to 1, it adds 6 to the MS hex digit of A and
sets Cy flag to 1.
GEC,Daman 8 221423107005
Practical-3
AIM: Add two numbers stored at 2000H and 2001H, Store the sum at 2002H
and carry at 2003H.
: Add 2 numbers
ADD B ;[A=A+B]
JNC SKIP ; jump if no carry
INR C ; make (C=1) if carry found
Output:
GEC,Daman 9 221423107005
Practical-3
ADD B ;[A=A+B]
HLT
Output:
GEC,Daman 10 221423107005
Practical-3
GEC,Daman 11 221423107005
Practical-4
Output:
GEC,Daman 12 221423107005
Practical-4
AIM: Write a program to move blocks of bits from source location starting at
2000 to 2009 to destination location starting from 3009 to 3000 where size of
blocks is 10 bytes.
GEC,Daman 13 221423107005
Practical-4
HLT
Output:
GEC,Daman 14 221423107005
Practical-4
GEC,Daman 15 221423107005
Practical-5
LDA 5000H ; Load the first number (at 5000H) into the accumulator
LDA 5001H ; Load the second number (at 5001H) into the accumulator
ADD B ; Add the contents of accumulator (second number) and register B (first number)
STA 5002H ; Store the result (in accumulator) to the desired location (5002H)
HLT
Output:
GEC,Daman 16 221423107005
Practical-5
ADD B ;A=A+B
ADC B ; A = A + B + CF
INR C ; increment C
HLT
GEC,Daman 17 221423107005
Practical-5
OUTPUT:
GEC,Daman 18 221423107005
Practical-6
MVI C, 10H
LXI H, 2000H
LXI D, 3000H
Loop: MOV A, M
STAX D
INX H
INX D
DCR C
JNZ Loop
HLT
OUTPUT:
GEC,Daman 19 221423107005
Practical-6
GEC,Daman 20 221423107005
Practical-7
DCR C ; decrement C
HLT
OUTPUT:
GEC,Daman 21 221423107005
Practical-7
LXI H,2000H
MVI C,0AH
MOV A,M
BACK:CMP M
JC SKIP
MOV A,M
SKIP:INX H
DCR C
JNZ BACK
MOV M,A
HLT
GEC,Daman 22 221423107005
Practical-7
OUTPUT:
GEC,Daman 23 221423107005
Practical-8
MVI C, 0AH
MVI A, 00H
MVI B, 00H
BACK: ADD M
JNC SKIP
INR B
SKIP: INX H
DCR C
JNZ BACK
MOV M, A
INX H
MOV M, B
HLT
OUTPUT:
GEC,Daman 24 221423107005
Practical-8
LXI H, 2000H
MOV A, M INX
H
CMP M JNC
SKIP MOV
C, M MOV
M, A DCX H
MOV M, C
SKIP: HLT
OUTPUT:
GEC,Daman 25 221423107005
Practical-8
OUTPUT:
GEC,Daman 26 221423107005
Practical-8
LXI H, 2000H
LXI D, 200AH
MVI C, 05H
CMA
INR A
STAX D
INX H
INX D
DCR C
JNZ BACK
HLT
GEC,Daman 27 221423107005
Practical-8
OUTPUT:
GEC,Daman 28 221423107005
Practical-9
MVI B, 04H
BACK2: MVI C, 04H
LXI H, 2000
BACK1: MOV A, M
INX H
CMP M
JC SKIP
JZ SKIP
MOV D, M
MOV M, A
DCX H
MOV M, D
INX H
SKIP: DCR C
JNZ BACK1
DCR B
JNZ BACK2
HLT
OUTPUT:
GEC,Daman 29 221423107005
Practical-10
AIM: Write an assembly language program to check the number of 1’s in the
location 2000H.
MVI B, 00H
MVI C, 08H
LDA 2000H
BACK:RLC
JNC SKIP
INR B
SKIP: DCR C
JNZ BACK
MOV A, B
STA 2001H
HLT
OUTPUT:
GEC,Daman 30 221423107005
Practical-11
AIM: write an assembly language program for 8085 interfacing with 8255 PPI
for traffic control.
JUMP UP
GEC,Daman 31 221423107005
Practical-12
GEC,Daman 32 221423107005
Practical-13
SUB C ;A=A-C
INR E ; Increment E by 1
OUTPUT:
GEC,Daman 33 221423107005
Practical-13
GEC,Daman 34 221423107005
Practical-14
LXI H, 0000H
LXI D, 0000H
LDA 2000H
MOV E, A
LDA 2001H
MOV C, A
BACK: DAD D
DCR C
JNZ BACK
SHLD 2002H
HLT
OUTPUT:
GEC,Daman 35 221423107005