Write a program to exchange the contents of memory locations.

Program Statment

  • Write a program to exchange the contents of memory locations D000H and D0001H.

Program 1:

Let the contents of memory location D000H be 10H and the contents of memory location D001H be 20H.

Assembly Language Program

InstructionCommentoperation
LDA D000HLoad data from memory location D000H to accumulatorA = 10 H
MOV B, AStore data in B registerB = 10 H
LDA D001HLoad data from the memory location D001H to the accumulatorLoad data from the memory location D001H to accumulator
STA D000Hstore data of Accumulator to memory location D000HD000H = 20H result
MOV A, BReload data in accumulator from B registerA = 10 H
STA D001Hstore data of Accumulator to memory location D001HD001H = 20H result
HLTStopStop

Result: D000H = 20H and D001H = 10H. i.e. the contents of the memory locations are exchanged.

Flow Chart of Program

flow chart 1

Program 2:

Assembly Language Program

InstructionCommentOperation
LXI H, D000HInitialize HL register pairs as a pointer to memory location D000H.HL = D000H
H = D0 H
L = 00 H
LXI D, D001HInitialize DE register pairs as a pointer to memory location D001H.DE = D001H
D = D0 H
E = 01 H
MOV B, MGet the contents of memory location D000H into the B registerB = 10H
LDAX DGet the contents of memory location D001H into the accumulator.A = 20H
MOV M, AGet the contents of memory location D000H into the B registerD000H = 20H result
MOV A, BCopy the contents of B register into accumulatorA = 10H
STAX DStore the contents of the accumulator in memory location D001HD001H = 10H result
HLTterminate program executionstop

Flow Chart of Program

flow chart 2

Sr. No.Name of the 8085 Programs
1.Write a program to load the data into the accumulator and any register.
2.Write a program to exchange the contents of memory locations.
3.Add two 8-bit numbers.
4.Subtract two 8-bit numbers.
5.Add two 16-bit numbers.
6.Subtract two 16-bit numbers
7.Find the 1’s complement of a Number
8.Find the 2’s complement of a Number
9.8085 Program To Mask The Lower Nibble
10.8085 Program To Mask The Upper Nibble
11.8085 program to pack the two unpacked BCD numbers
12.8085 program to Unpack the two packed BCD numbers
13.8085 program to find the sum of a series of 8-bit numbers
14.8085 Program to sort the numbers in ascending order
15.8085 Program to sort the numbers in Descending order
16.8085 Program to Multiply Two 8-bit Numbers
17.8085 Program to Divide 16-bit number by 8-bit number
18.8085 Program to Find the Number of Negative Numbers in Array
19.8085 Program to Find Maximum Number in Array
20.8085 Program to count the number of 1’s in a register
21.8085 Program to Calculate the sum of a series of even numbers
22.8085 Program to find the square of numbers
23.8085 Program to find the smallest number in the array

Hello friends, my name is Trupal Bhavsar, I am the Writer and Founder of this blog. I am Electronics Engineer(2014 pass out), Currently working as Junior Telecom Officer(B.S.N.L.) also I do Project Development, PCB designing and Teaching of Electronics Subjects.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

telegram logo Join Our Telegram Group!