0% found this document useful (0 votes)
6 views17 pages

8085 Assembly Language Program Guide

The document provides a detailed outline of assembly language programs for the 8085 microprocessor, covering topics such as addition, multiplication, and 2's complement. It includes several example programs with step-by-step instructions and flowcharts for tasks like adding two 8-bit numbers, displaying a reverse counter, and exchanging blocks of numbers. Additionally, it lists exam questions and lab assignments related to assembly language programming for further practice.

Uploaded by

teddatopkifle
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)
6 views17 pages

8085 Assembly Language Program Guide

The document provides a detailed outline of assembly language programs for the 8085 microprocessor, covering topics such as addition, multiplication, and 2's complement. It includes several example programs with step-by-step instructions and flowcharts for tasks like adding two 8-bit numbers, displaying a reverse counter, and exchanging blocks of numbers. Additionally, it lists exam questions and lab assignments related to assembly language programming for further practice.

Uploaded by

teddatopkifle
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

Microprocessor and Interfacing

(MPI)
GTU # 3160712

Unit-5:
8085 Assembly
Language Programs
 Topics
Loopingto be covered

 Writing 8085 assembly language programs


 Decision making programs
 Looping using data transfer programs
 Arithmetic, logical and branch instructions programs
Program-1
Write an ALP to add two 8-bit numbers. Add the value of carry to final Start
result and display the result to I/O port.

Load A and B
1. MVI A,3A with immediate
value
2. MVI B,20
3. ADD B
AA+B
4. JC L1
5. JNC DISP YES
Increment
Carry?
6. L1: INR A Result by 1

7. DISP: OUT 02 NO
Display result to
8. END: HLT
I/O port

End
Program-2
Write an ALP to display reverse counter at port 02H.
Start
1. MVI A,0A ;counter

2. L1: OUT 02 Load & Display


Counter
3. DCR A ;A=A-1

4. JNZ L1 ;Z=0 Decrement A

5. HLT
NO
Z=1?

YES

End
Program-3
Write an ALP to find 2’s compliment of M[2001] and store result at M[2002].
Start
1. LDA 2001

2. CMA Load AM[2001]

3. ADI 01
Complement
Accumulator
4. STA 2002

5. HLT 2’scomplement=
1’s complement +01

Store result

END
Program-4
Write an ALP to multiply two 8-bit numbers stored at 2050H & 2051H using repetitive Load HL 2050
addition method. Load A  00
1. LXI H,2050
Load
2. MVI A,00
C M[2050](OP1)
3. MOV C,M; OP1 B M[2051](OP2)
4. INX H
HL HL+1
5. MOV B,M; OP2
6. L1: ADD C A A+C

7. DCR B Decrement B
8. JNZ L1 B B-1

9. HLT
NO
Z=1 ?

YES
End
GTU Exam Questions
Sr. Questions Marks Year
1. Write assembly language program to do multiplication of two numbers. Specify the memory location 7 W’19
of each and every instruction and also draw flowchart.
Program-5
Write an ALP to multiply two 8-bit numbers stored at 2050H & 2051H using repetitive Load HL 2050
addition method. Load A  00

Line Program PC Byte Load


0. - 0000 - C M[2050](OP1)
B M[2051](OP2)
1. LXI H,2050 0003 3
2. MVI A,00 0005 2
HL HL+1
3. MOV C,M 0006 1
4. INX H 0007 1 A A+C
5. MOV B,M 0008 1
Decrement B
6. L1: ADD C 0009 1
B B-1
7. DCR B 000A 1
8. JNZ L1 0009/000D 3 NO
9. HLT 1 Z=1 ?

YES
End
Program-6
Write an ALP to add 10 blocks starting from 3001H to 300AH. Start
1. MVI A,00
2. MVI C,0A Load A00
Load C 0A
3. LXI H,3001 Load HL 3001
4. L1:ADC M
A A+M
5. INX H
6. DCR C Increment
HLHL+1
7. JNZ L1
Decrement Counter
8. HLT CC-1

NO
Z=1 ?

YES
END
Program-7
Write a program to Set PSW (Accumulator & 8-bit Flag register)

1. LXI H, FFFF

2. PUSH H

3. POP PSW ;lower 8-bit to flags,higher 8-bit to Accumulator

4. HLT
Program-8
Write a program to Reset PSW (Accumulator & 8-bit Flag register)

1. LXI H, 0000

2. PUSH H

3. POP PSW

4. HLT
Program-9
Write an ALP to exchange block of 10 numbers with starting location Load HL 2001
M[2001] & M[3001] respectively. Load DE 3001
M[2001] 11
AA M[3001] AA
11 END
1. LXI H,2001
22
BB Load Counter_C 0A
M[2002] BB
22 M[3002] YES
2. LXI D,3001
M[2003] 33
CC M[3003] CC
33 NO
3. MVI C,0A Z=1 ? Load B M[HL]
4. L1:MOV B,M C HL DE B A Z
5. LDAX D 03 2001 3001 11 AA 0
Decrement Counter C Load A M[DE]
6. MOV M,A
7. XCHG 02 3002 2002 BB 22
HL HL+1
Load M[HL] A
8. MOV M,B DE DE+1
9. INX H 01 2003 3003 33 CC
10. INX D Load M[HL] B Exchange HL ⇋ DE
11. DCR C 00 3004 2004 1
12. JNZ L1
13. HLT
Exercise
Sr. Program
1. Write an 8085 program to add two 16-bit nos stored in memory locations 2100H and 2200H respectively.
Lab assignment
Sr. Questions Marks
1. Write assembly language program to do multiplication of two numbers. Specify the memory location of 3
each and every instruction and also draw flowchart.
2. Write assembly language program to do division of two numbers. Specify the memory location of each and 3
every instruction and also draw flowchart.
3. Write assembly language program to do addition of two 8-bit numbers with carry. Specify the memory 3
location of each and every instruction.
4. Write assembly language program to count number of 1’s in given 8-bit number. Specify the memory 3
location of each and every instruction.
5. An array of Ten numbers is stored from memory location 2000H onwards. Write an 8085 assembly 3
language program to separate out and store the EVEN and ODD numbers on new arrays from 2100H and
2200H, respectively.
6. Write an 8085 assembly language program sort an array of twenty bytes stored on memory locations 3
2000H onwards in ascending/descending order.
References
Book: Microprocessor Architecture, Programming, and Applications with the 8085,
Ramesh S. Gaonkar Pub: Penram International

Mobile 8085 and 8086 Microprocessor Opcodes app from Play Store:
Application [Link]

You might also like