Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

ii)

;Set the lower nibble of 8-bit number stored at memory location 2000H without
;affecting the higher nibble

LDA 2000
ORI 00FH
STA 2000
HLT

iii)
;Complement the lower nibble of the 8-bit number stored at memory location 2050H
;without affecting the higher nibble.
LDA 2000
XRI 00FH
STA 2000
HLT

iv)
; Interchange the nibbles of the 8-bit number stored at memory location 3000H.
LDA 3000H
MVI C,04H
Back: RRC
DCR C
JNZ Back
STA 3000H
Hlt
v)
;Identify the 6th bit (D6) of the 8-bit number stored at memory location 3050H
LDA 3050H
MVI C,06H
MVI D, 00H
Back: RLC
DCR C
JNZ Back
JNC SKIP
INR D
SKIP: MOV A,D
STA 3050H
HLT

Output:

i)
ii)

iii)
iv)

v)
Question 2: Write an Assembly Language Program to complement the
lower nibble of the 8-bit number stored at memory location 2050H
without affecting the higher nibble.

LDA 2050H
XRI 00FH
STA 2050H
HLT

Output:
Question 3: Write an Assembly Language Program to check whether the
8-bit number stored at memory location 2050H is even or odd. If even,
store 22H at memory location 3050H otherwise, store 11H at memory
location 3050H.

LDA 2050H
RRC
JNC SKIP
MVI A,11H
SKIP: MVI A,22H
STA 3050H
Hlt

Output:
Question 4: Write an Assembly Language Program to check whether the
8-bit number stored at memory location 2050H is positive or negative. If
positive, store 00H at memory location 3050H otherwise store 01H at
memory location 3050H.

;Write an Assembly Language Program to check whether the 8-bit number stored at
;memory location 2050H is positive or negative. If positive, store 00H at memory
location
;3050H otherwise store 01H at memory location 3050H

LDA 2050H
RLC
JNC SKIP
MVI A,01H
SKIP: MVI A,00H
STA 3050H
Hlt

Output:
Question 5: Write an Assembly Language Program to find the number of
1’s in an 8-bit number stored at memory location 2050H.

;Write an Assembly Language Program to find the number of 1’s in an 8-bit number
;stored at memory location 2050H.

LDA 2050H
MVI C,08H
MVI D,00H
BACK: RLC
JNC SKIP
INR D
SKIP: DCR C
JNZ BACK
MOV A,D
STA 2051H
HLT

Output:
Question 6: Write an assembly language program to separate odd and
even numbers from the given list of 10 numbers. Store odd numbers in
another list starting from memory location 2100H. Store even numbers in
another list starting from memory location 2200H. Starting address of the
list is 2000H.

;Write an assembly language program to separate odd and even numbers from the
given
;list of 10 numbers. Store odd numbers in another list starting from memory location
;2100H. Store even numbers in another list starting from memory location 2200H.
Starting
;address of the list is 2000H.

LXI D, 2100H
LXI H, 2000H
MVI C, 0AH
BACK: MOV A,M
RRC
JNC SKIP
MOV A,M
STAX B
INX B
SKIP: INX H
DCR D
JNZ BACK

LXI B, 2200H
LXI H, 2000H
MVI D, 0AH
BACKR: MOV A,M
RRC
JC SKIPS
MOV A,M
STAX B
INX B
SKIPS: INX H
DCR D
JNZ BACKR

HLT

Output:

You might also like