Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (1 vote)
549 views

Microprocessor 8085 Programming

The document contains 21 problems related to 8085 microprocessor assembly language programming. The problems involve tasks like adding numbers stored in memory locations, displaying results, transferring data between tables, converting between binary and BCD formats, and inserting or removing data from tables. Sample code solutions are provided for each problem using instructions like MOV, ADD, SUB, CMP, JMP, CALL and others.

Uploaded by

Rajiv Shah
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
549 views

Microprocessor 8085 Programming

The document contains 21 problems related to 8085 microprocessor assembly language programming. The problems involve tasks like adding numbers stored in memory locations, displaying results, transferring data between tables, converting between binary and BCD formats, and inserting or removing data from tables. Sample code solutions are provided for each problem using instructions like MOV, ADD, SUB, CMP, JMP, CALL and others.

Uploaded by

Rajiv Shah
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 13

1.

Write an 8085 program to add ten numbers stored in consecutive memory address starting from
8067H and store the sixteen bit result at the end of the table.
2. Write an 8085 program to add ten numbers stored in the consecutive memory locations starting
from 8081H and display the result in the two output ports. (you can assume any address for the port)
3. Add all the positive numbers stored in the memory location 80A1H to 80AAH. Display the 16-bit
result in any ports.
4. Add all the numbers with bit D5 and D3, 1 and 0 respectively, stored in the memory location
90B1H to 90BAH. Display the 16-bit result in any ports.
5. There are two table of data stored at 80A1H and 80B1H having ten data each. Write a program to
store the data in the first table to third table starting from address 80C1H if the corresponding data in
the first table is greater than the second table else store FFH in the third table.
6. Sixteen bit data are stored in two tables starting at 8050H and 8070H, ten data in each table. Add
corresponding data and store it in the third table starting at 8090H. (Never forget the reverse order
convention in storing the 16-bit data)
7. Add sixteen bit data stored in two tables and store the result in the corresponding index of the
third table if the result in the corresponding index of the third table only if the result is greater than
00FFH, else store 0000H (you can assume any address for the tables)
8. In two tables 16-bit data are stored, each table having ten numbers each. Subtract the data from
one table to other and store the result in the third table.
9. Subtract ten 16-bit data stored in one table from the other. Store the result in the third table if the
result is positive else store 00.
10. Transfer ten data, which has bit D 5 and D0, 0 and 1 respectively from A430H to A440H, else store
00 instead of transformation.
11. Transfer ten data with even parity from location 9270H to 9280H, else transfer the data by
clearing bit D7 and setting bit D2.
12. Data is stored from 8040H to 8050H. Transfer the data to other location in reverse order.
13. Add ten 16-bit numbers stored in a table at 9500H and store the 24-bit result at the end of the
table.
14. Data is stored from 8050H to 805AH. Insert 5 data after 8055H taking from 8040H, but do not
lose the previous content.
15. Ten data are stored from 8080H. Transfer the first 5 numbers at the end of the second table and
the rest at the starting of it.

16. Transfer data from 9050H to 9060H only if data is between 30H and 70H else store 00H in the
next table.
17. Transfer data from 8250H to 8260H if the number is less than 50H and greater than 80H else
store 00H in the destination table.
18. Write a program to count the number of ones of table of ten sixteen bit numbers at 8240H and
store the count of ones in corresponding location of a table at 8260H
19. Write a program to convert binary numbers stored in a table at 8560h to BCD numbers and store
the result in the second table at 8570H. Assume no number is greater than 63H (99D).
20. Write a program to convert ten BCD numbers stored at 8350H to binary and store the result at
8360H.
21. Ten data are stored in memory location starting at 8345H. Write a program to convert binary
number to BCD number and store the result in the second table in the memory location starting at
8445H if the result is less than hundred.

1)
MVI A,00
LXI H,8067
LXI D,0000
MVI B,0A
L1: MOV A,M
INX H
ADD E
MOV E,A
JNC L2
INR D
L2: DCR B
JNZ L1
XCHG
SHLD 8071
HLT
2)
MVI A,00
LXI H,8081
LXI D,0000
MVI B,0A
L1: MOV A,M
INX H

ADD E
MOV E,A
JNC L2
INR D
L2:DCR B
JNZ L1
MVI A,80
OUT 43
MOV D,A
OUT 40
MOV E,A
OUT 41
HLT
3) MVI A,00
LXI H,80A1
LXI D,0000
MVI B,0A
L1: MOV A,M
INX H
RLC
JC L2
RRC
ADD E
MOV E,A
JNC L2
INR D
L2:DCR B
JNZ L1
MVI A,80
OUT 43
MOV A,D
OUT 40
MOV A,E
OUT 41
HLT
4)
MVI A,00
LXI H,90B1

LXI D,0000
MVI B,0A
L1: MOV A,M
INX H
RRC
RRC
RRC
RRC
JC L2
RRC
RRC
JNC L2
RRC
RRC
ADD E
MOV E,A
JNC L2
INR D
L2:DCR B
JNZ L1
MVI A,80
OUT 43
MOV A,D
OUT 40
MOV A,E
OUT 41
HLT
5)
LXI B,80A1
LXI H,80B1
LXI D,80C1
L3:LDAX B
CMP M
JC L1
JZ L1
STAX D
JMP L2
L1:
MVI A,FF

STAX D
L2:
MOV A,C
CPI AA
INX B
INX H
INX D
JNZ L3
HLT
6)
LXI B,8050
LXI H,8070
LXI D,8090
L3:LDAX B
ADD M
STAX D
INX B
INX H
INX D
LDAX B
JC L1
ADD M
JMP L2
L1: ADC M
L2:STAX D
INX B
INX H
INX D
MOV A,C
CPI 5A
JNZ L3
HLT
7)
LXI B,8050
LXI H,8070
LXI D,8090
L3:LDAX B

ADD M
STAX D
INX B
INX H
INX D
LDAX B
JC L1
ADD M
JC L2
JNZ L2
DCX D
STAX D
INX D
STAX D
JMP L4
L1: ADC M
L2:STAX D
L4:INX B
INX H
INX D
MOV A,C
CPI 5A
JNZ L3
HLT
8)
LXI B,8050
LXI H,8070
LXI D,8090
L3:LDAX B
SUB M
STAX D
INX B
INX H
INX D
LDAX B
JZ L4
JC L1
L4:SUB M
JMP L2

L1: SBB M
L2:STAX D
INX B
INX H
INX D
MOV A,C
CPI 5A
JNZ L3
HLT
9)
LXI B,8050
LXI H,8070
LXI D,8090
L3:LDAX B
SUB M
STAX D
INX B
INX H
INX D
LDAX B
JC L1
L4:SUB M
JMP L2
L1: SBB M
L2:JZ L5
JNC L5
MVI A,00
DCX D
STAX D
INX D
L5:STAX D
INX B
INX H
INX D
MOV A,C
CPI 5A
JNZ L3
HLT

10)
LXI B,A430
LXI H,A440
MVI D,0A
L3:LDAX B
RRC
JNC L1
RRC
RRC
RRC
RRC
RRC
JC L1
RRC
RRC
JMP L2
L1:MVI A,00
L2:MOV M,A
INX B
INX H
DCR D
JNZ L3
HLT
11)
LXI B,9270
LXI H,9280
MVI D,0A
L2:LDAX B
ADI 00
JPE L1
ANI 7F
ORI 01
L1:MOV M,A
INX B
INX H
DCR D
JNZ L2
HLT

12)
LXI B,8040
LXI H,9050
MVI D,11
L1:LDAX B
MOV M,A
INX B
DCX H
DCR D
JNZ L1
HLT
13)
LXI B,9500
LXI H,0000
LXI D,0009
LDAX B
MOV L,A
INX B
LDAX B
MOV H,A
L1:INX B
LDAX B
ADD L
MOV L,A
INX B
LDAX B
JC L2
ADD H
JMP L3
L2:ADC H
L3:MOV H,A
JNC L4
INR D
L4:DCR E
JNZ L1
MOV A,L
INX B
STAX B

MOV A,H
INX B
STAX B
MOV A,D
INX B
STAX B
HLT
15)
LXI B,8080
LXI H,9085
MVI D,05
L1: LDAX B
MOV M,A
INX B
INX H
DCR D
JNZ L1
MVI D,05
LXI H,9080
L2: LDAX B
MOV M,A
INX B
INX H
DCR D
JNZ L2
HLT
16)
LXI B,9050
LXI H,9060
MVI D,0A
L1: LDAX B
CPI 30
JC L2
JZ L2
LDAX B
CPI 70
JNC L2
JZ L2

LDAX B
MOV M,A
JMP L3
L2:MVI A,00
MOV M,A
L3:INX B
INX H
DCR D
JNZ L1
HLT
18)
LXI B,8240
LXI H,8260
L5:
MVI D,08
LDAX B
L1:
RRC
JNC L2
INR E
L2:DCR D
JNZ L1
INX B
MVI D,08
LDAX B
L3:
RRC
JNC L4
INR E
L4:DCR D
JNZ L3
MOV M,E
MVI E,00
INX B
INX H
MOV A,C
CPI 54
JNZ L5
HLT

19)
LXI H, 8560
LXI B, 8570
MVI A,00
MVI E,0A
MAIN:
MOV D,M
L1: INR A
DCR E
JNZ L2
ADI 06
MVI E,0A
L2: DCR D
JNZ L1
STAX B
MOV A,L
CPI 6A
MVI A,00
MVI E,0A
INX H
INX B
JNZ MAIN
HLT
20)
LXI H, 8350
LXI B, 8360
MAIN:
MVI A,00
MVI E,10
MOV D,M
L1: INR A
DCR E
JNZ L2
SBI 06
MVI E,10
L2: DCR D
JNZ L1
STAX B

MOV A, L
CPI 6A
INX H
INX B
JNZ MAIN
HLT
21)
LXI H, 8345
LXI B, 8355
MAIN:
MOV D,M
MOV A,D
CPI 64
JNC L3
MOV D,M
MVI A,00
MVI E,0A
L1: ADI 01
DCR E
JNZ L2
ADI 06
MVI E,0A
L2: DCR D
JNZ L1
STAX B
L3:MOV A,L
CPI 4F
INX H
INX B
JNZ MAIN
HLT

You might also like