Q. Write a program to load the bit pattern 91H in register B and 87H in register C, mask all
the bits except D0 from registers B and C, and if D0 is at logic 1 in both the registers, turn
on the light connected to the D0 position of the output port 01H; otherwise, turn off the
light.
MVI B, 91H
MVI C, 87H
MOV A, B
ANI 01H
MOV B, A
MOV A, C
ANI 01H
MOV C, A
ANA B
JNZ LABEL
MVI A, 00H
OUT 01H
HLT
LABEL: MVI A, 01H
OUT 01H
HLT
the bits except D0 from registers B and C, and if D0 is at logic 1 in both the registers, turn
on the light connected to the D0 position of the output port 01H; otherwise, turn off the
light.
MVI B, 91H
MVI C, 87H
MOV A, B
ANI 01H
MOV B, A
MOV A, C
ANI 01H
MOV C, A
ANA B
JNZ LABEL
MVI A, 00H
OUT 01H
HLT
LABEL: MVI A, 01H
OUT 01H
HLT
Comments
Post a Comment