Professional Documents
Culture Documents
Lab 3
Lab 3
LAB 3
*********
______________________________________________________________________
LDA 9030H
MVI B,92H
ANA B
HLT
______________________________________________________________________
______________________________________________________________________
LDA 9030H
ANI 10H ;if D4 is zero, zero flag(Z) will be raised by this instruction
HLT
______________________________________________________________________
______________________________________________________________________
LHLD 9024H
MOV A,H
ORA L
STA 9026H
HLT
______________________________________________________________________
______________________________________________________________________
LHLD 9027H
MOV A,L
XRA H
STA 9029H
HLT
______________________________________________________________________
______________________________________________________________________
5.Logical instructions can also be used to mask certain bits of a word
Write a program to complement bit D6 of data at memory location 9025.
Assume data in 9025 is 79.
LDA 9025H
XRI 40H ;D6 is complemented by this instruction while all other
STA 9025H ;bits remain unchanged
HLT
______________________________________________________________________
______________________________________________________________________
6.We can complement the accumulator content by using instruction other
than CMA How is that possible? Write a program to illustrate this.
MVI A, 0F0h
XRI 0FFH ;complements the acc. content to 0Fh.
HLT
______________________________________________________________________
______________________________________________________________________
7.Write a program to compare the content of the memory 8081--36
location 8081 and 8082. Subtract the memory content at 8082--A4
8082 from 8081 and see whether the flag content is same 8083--
as the compare instruction or not.
a)
LHLD 8081H
MOV A,L
CMP H
HLT
b)
LHLD 8081H
MOV A,L
SUB H
HLT
______________________________________________________________________
______________________________________________________________________
8.Write a program to check the bit D5 of the content of memory at
9025. Display 1 at port A if the bit is 1 else displays nothing. Use
the rotating instructions after masking. Use the rotating instruction
which uses less no of instructions.
LDA 9025H
ANI 20H
JNZ L2
HLT
L2: RLC
RLC
RLC
OUT 0AH
L1: HLT
______________________________________________________________________
______________________________________________________________________
9.Change the program in assignment 8 to display 80H if the bit is 1
else nothing.
LDA 9025H
ANI 20H
JNZ L2
HLT
L2: RLC
RLC
OUT 0AH
L1: HLT
______________________________________________________________________