0% found this document useful (0 votes)
32 views14 pages

Old Question Solution 8085 Program

The document contains a series of assembly language programs for the 8085 microprocessor, each addressing different computational tasks such as finding the largest and smallest bytes, counting specific conditions in data, and manipulating data bytes. Each program is accompanied by a specific problem statement, solution code, and comments explaining the logic behind the code. The solutions involve various operations including arithmetic, logical operations, and data transfers between memory locations.

Uploaded by

Aayushka Dahal
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)
32 views14 pages

Old Question Solution 8085 Program

The document contains a series of assembly language programs for the 8085 microprocessor, each addressing different computational tasks such as finding the largest and smallest bytes, counting specific conditions in data, and manipulating data bytes. Each program is accompanied by a specific problem statement, solution code, and comments explaining the logic behind the code. The solutions involve various operations including arithmetic, logical operations, and data transfers between memory locations.

Uploaded by

Aayushka Dahal
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/ 14

8085 OLD QUESTION SOLUTION BY SUROJ BURLAKOTI

1. Write a program in 8085 to find the largest and smallest bytes from the list of 20 bytes stored starting from
memory location C050H. Store the largest byte and smallest byte in C070H and C071H respectively. (8)
[2076 BAISAKH]

Solution:

LXI H,C050H

MVI C,13H

MOV E,M

MOV D,M

NEXT:INX H

MOV A,E

CMP M

JNC SKIP1

MOV E,M

SKIP1: MOV A,D

CMP M

JC SKIP2

MOV D,M

SKIP2: DCR C

JNZ NEXT

XCHG

SHLD C070H

HLT

DRAFT DRAFT DRAFT


8085 OLD QUESTION SOLUTION BY SUROJ BURLAKOTI
2. Write a program for 8085 to count the numbers for which upper nibble is higher than the lower nibble; and
store the count at the end of the table having 50 bytes data from C050H. (8) [2075 Bhadra]

Solution:

LXI H,C050H
MVI C,32H
MVI D,00H
NEXT:MOV A,M
ANI 0FH
MOV B,A
MOV A,M
ANI F0H
RLC
RLC
RLC
RLC
CMP B
JC SKIP
JZ SKIP
INR D
SKIP: INX H
DCR C
JNZ NEXT
MOV A,D
STA CO82H
HLT

DRAFT DRAFT DRAFT


8085 OLD QUESTION SOLUTION BY SUROJ BURLAKOTI
3. Write a ALP in 8085 to transfer 20 bytes of data in a table to another table by interchanging D1 and D4 bits of
each byte. (6) [2075 Baisakh]

Solution:

Hint:
To interchange D1 and D4 in each data byte
Data Byte: D7 D6 D5 D4 D3 D2 D1 D0
ANDing by: 0 0 0 1 0 0 1 0 = 12H to check D4 and D1 bit
Possible result: 0 0 0 0 0 0 0 0 = 00H (if D1=0 & D4=0 no need to interchange)
0 0 0 0 0 0 1 0 = 02H (if D1=1 & D4=0 complement both bits for interchange)
0 0 0 1 0 0 0 0 = 10H (if D1=0 & D4=1 complement both bits for interchange)
0 0 0 1 0 0 1 0 = 12H (if D1=1 and D4=1 no need to interchange)

Program:

LXI H,8050H ;Initialize starting address of source table


LXI D,8070H ;Initialize starting address of destination table
MVI C,14H ;initialize loop counter for 20 bytes
UPPER: MOV A,M
ANI 12H
JZ SKIP
CPI 12H
JZ SKIP
MOV A,M
XRI 12H
JMP LOWER
SKIP: MOV A,M
LOWER: STAX D
INX H
INX D
DCR C
JNZ UPPER
HLT

DRAFT DRAFT DRAFT


8085 OLD QUESTION SOLUTION BY SUROJ BURLAKOTI
4. There are two tables holding twenty data whose starting address is 9000H and 9020H respectively. WAP to add
the content of first table with content of second table having same array index. Store sum and carry into the
third and fourth table indexing from 9040H and 9060H respectively. (8) [2074 Bhadra]
Solution:

LXI H,9000H
LXI B,9040H
LXI D,9060H
L3:PUSH H
MOV A,L
ADI 20H
MOV L,A
MOV A,M
POP H
ADD M
STAX B
JNC L1
MVI A,01H
JMP L2
L1:MVI A,00H
L2:STAX D
INX B
INX D
INX H
MOV A,E
CPI 74H
JC L3
HLT

DRAFT DRAFT DRAFT


8085 OLD QUESTION SOLUTION BY SUROJ BURLAKOTI
5. Write an ALP for 8085 to find the square of ten 8-bit numbers which are <=0FH, stored from memory location
C090H. Store the result from the end of the source table. (8) [2073 Magh]
Solution:
LXI H,C090H
LXI D,CO9AH
REPEAT:MOV A,M
CPI 10H
JNC SKIP
MOV B,M
MOV C,M
MVI A,00H
UP:ADD B
DCR C
JNZ UP
JMP LOWER
SKIP:MOV A,M
LOWER:STAX D
INX H
INX D
MOV A,L
CPI 9A
JC REPEAT
HLT

DRAFT DRAFT DRAFT


8085 OLD QUESTION SOLUTION BY SUROJ BURLAKOTI
6. Write a program for 8085 to calculate the numbers of ones in the upper nibble of ten 8-bit numbers stored in
table. Store the count in memory location just after the table. (8) [2072 Ashwin]

Solution:

LXI H,9000H

MVI D,0AH

MVI B,00H

REPEAT: MVI C,04H

MOV A,M

NEXT: RLC

JNC SKIP

INR B

SKIP: DCR C

JNZ NEXT

INX H

DCR D

JNZ REPEAT

MOV A,B

MOV M,A

HLT

DRAFT DRAFT DRAFT


8085 OLD QUESTION SOLUTION BY SUROJ BURLAKOTI
7. Write a program for 8085 to generate multiplication table of number stored at 8230h and store the generated
table starting at 8231H. For example if location 8230H is 05H, store 0AH in 8231H and so on.(8) [2072 Magh]
Solution:
LDA 8230H
MOV B,A
LXI D,8231H
MVI C,09H
ADD B
STAX D
INX D
DCR C
JNZ UP
HLT

DRAFT DRAFT DRAFT


8085 OLD QUESTION SOLUTION BY SUROJ BURLAKOTI
8. Write a program for 8085 to add upper nibble and lower nibble of ten 8-bit words stored in a table that starts
from location 8B20H.Store the separate results in location just after the table. (8) [2071 Bhadra]
Solution:
LXI H,8B20H
LXI D,8B2AH
MVI C,0AH
NEXT: MOV A,M
ANI 0FH
MOV B,A
MOV A,M
ANI F0H
RLC
RLC
RLC
RLC
ADD B
STAX D
INX H
INX D
DCR C
JNZ NEXT
HLT

DRAFT DRAFT DRAFT


8085 OLD QUESTION SOLUTION BY SUROJ BURLAKOTI
9. Write a assembly level language program for 8085. Table 1 contains 16 no. of 8-bit data. Transfer data which has
no. of 1’s greater than 3 from table 1 to table 2, otherwise store FFH in table 2. (8) [2071 Magh]
Solution:
LXI H,9000H
LXI D,9010H
MVI C,10H
MVI B,00H
NEXTDATA: PUSH B
MVI C,08H
MOV A,M
NEXTBIT: RLC
JNC SKIP
INR B
SKIP: DCR C
JNZ NEXTBIT
MOV A,B
CPI 04H
JC L1
MOV A,M
JMP L2
L1: MVI A,FFH
L2: STAX D
INX H
INX D
POP B
DCR C
JNZ NEXTDATA
HLT

DRAFT DRAFT DRAFT


8085 OLD QUESTION SOLUTION BY SUROJ BURLAKOTI
10. Write an ALP for 8085 to divide a byte stored in memory location 9070H by byte at 9071H and store the
remainder and quiescent in location 9072H and 9073H respectively. (8) [2070 Magh]
Solution:
LHLD 9070H
MVI B,00H
AGAIN: MOV A,L
SUB H
JC COMPLETE
MOV L,A
INR B
JMP AGAIN
COMPLETE: MOV H,B
SHLD 9072H
HLT

DRAFT DRAFT DRAFT


8085 OLD QUESTION SOLUTION BY SUROJ BURLAKOTI
11. Write a program to convert ten BCD numbers stored at 4350H to binary and store the result at 4360H. (8)
[2069 Bhadra]

Solution:

Hint:
Algorithm:
1. Load the BCD number in the accumulator
2. Unpack the 2 digit BCD number into two separate digits. Let the left digit be BCD1and the right one BCD2
3. Multiply BCD1 by 10 and add BCD2 to it
If the 2 digit BCD number is 72, then its binary equivalent will be 7 x OAH + 2 = 46H + 2 = 48H
Input : 72H (0111 0010)2
Output : 48H (in hexadecimal) (0011 0000)2
((4x16)+(8x1))=72
Program:

LXI H,4350H
LXI D,4360H
MVI C,0AH
NEXTDATA:MOV A,M
ANI OFH
MOV B,A
PUSH B
MOV A,M
ANI F0H
JZ SKIPMULTIPLY
RLC
RLC
RLC
RLC
MVI C,0AH
MOV B,A
XRA A
AGAIN: ADD B
DCR C
JNZ AGAIN
SKIPMULTIPLY:POP B
ADD B
STAX D
INX H
INX D
DCR C
JNZ NEXTDATA
HLT

DRAFT DRAFT DRAFT


8085 OLD QUESTION SOLUTION BY SUROJ BURLAKOTI
12. Write a program in 8085 to transfer bytes of data with odd parity from location 9205H to A200H. else transfer
the data by clearing bit D5 and setting bit D3. The end of the data is indicated by 51H in data. (8) [2069 Poush]

Solution:

LXI H,9205H
LXI D,A200H
NEXTDATA:MOV A,M
ADI 00H
JPO STORE
ANI DFH
ORI 08H
STORE: STAX D
MOV A,M
CPI 51H
JZ FINISH
INX H
INX D
JMP NEXTDATA
FINISH: HLT

DRAFT DRAFT DRAFT


8085 OLD QUESTION SOLUTION BY SUROJ BURLAKOTI
13. Write a program in 8085 to transfer 8085 to transfer 8-bit number from one table to another by setting bit D5 if
the number is less than 80H, else transfer the number by resetting bit D6. (8) [2068 bhadra]

Solution:
LXI H,9000H
LXI D,9020H
MVI C,0AH
NEXTDATA:MOV A,M
CPI 80H
JC SETBIT
ANI BFH
JMP STORE
SETBIT: ORI 20H
STORE:STAX D
INX H
INX D
DCR C
JNZ NEXTDATA
HLT

DRAFT DRAFT DRAFT


8085 OLD QUESTION SOLUTION BY SUROJ BURLAKOTI
14. Ten numbers of 8-bit data is started in memory at A000H. Write a program for 8085 microprocessor to copy the
data to next table at A030H, if the data is less than 70H and greater than 24H. (8) [2068 POUSH]

SOLUTION:

LXI H,A000H
LXI D,A030H
MVI C,0AH
NEXTDATA: MOV A,M
CPI 70H
JNC SKIP
CPI 25H
JC SKIP
JMP STORE
SKIP: MVI A,00H
STORE: STAX D
INX H
INX D
DCR C
JNZ NEXTDATA
HLT

DRAFT DRAFT DRAFT

You might also like