Python,C,C++ and JAVA programs for CBSE, ISC, B.Tech and I.T Computer Science and MCA students

The Programming Project: June 2013

Monday, June 10, 2013

Interchanging specific bits

There are N bytes stored from m/m location 0001H. The value of N is stored in 000H. Write an 8085 program to interchange the bits D2 and D6 and store them into the m/m locations starting from 0010H.

LXI H,0000H
MOV B,M
INX H
LXI D,0010H
XRA A
MOV C,A
LOOP: MOV A,M
ANI 0EDH
ADD C
MOV C,A
MOV A,M
ANI 02H
RLC
RLC
RLC
ADD C
MOV C,A
MOV A,M
ANI 10H
RRC
RRC
RRC
ADD C
MVI C,00H
STAX D
INX H
INX D
DCR B
JNZ LOOP
HLT