MPMC EXAM
MPMC EXAM
MPMC EXAM
LDA 2000H
CMA
STA 2006H
INR A
STA 2007H ; Store 2's complement Result
HLT
(1.b) Write an 8085 ALP to find 1’s and 2’s complement of 16-bit number
stored in Memory.
LHLD 2000H
MOV A,L
CMA
MOV L,A
MOV A,H
CMA
MOV H,A
SHLD 2006H
INX H
SHLD 2008H
HLT
(2.a) To write an 8085 ALP to add two 8-bit number that results in an8-
bit number.
LXI H,2000H
MOV A,M
INX H
ADD M
STA 2006H
HLT
(2.b) To write an 8085 ALP to add two 8-bit number that may results in a
16-bit number.
LXI H,2000H
LXI D,2006H
MVI B,00H
MOV A,M
INX H
ADD M
JNC SKIP
INR B
SKIP: STAX D
INX D
MOV A,B
STAX D
HLT
(3.a) To write an 8085 ALP to add two 16-bit number using DAD
instruction.
XRA A
LHLD 2002H
XCHG
LHLD 2000H
DAD D
JNC NXT
INR B
NXT: SHLD 2006H
STA 2008H
HLT
(3.b) To write an 8085 ALP to add two 16 bit number without using DAD
instruction.
LXI H, 2000H
MVI B, 0
MOV A,M
INX H
INX H
ADD M
STA 2006H
DCX H
MOV A,M
INX H
INX H
ADC M
JNC NXT
INR B
NXT: STA 2007H
MOV A,B
STA 2008H
HLT
(4.a) Write an ALP to subtract two 8-bit numbers using “SUB Instruction”
LXI H,2000H
MOV A,M
INX H
SUB M
STA 2006H
HLT
(4.b) Write an ALP to subtract two 8-bit numbers without using “SUB”
instruction
LXI H,2000H
MOV A,M
INX H
MOV C,M
LOOP: DCR A
DCR C
JNZ LOOP
STA 2006H
HLT
LXI H, 2000H
MVI B, 00H
MOV A, M
INX H
INX H
ADD M
DAA
STA 2006H
DCX H
MOV A, M
INX H
INX H
ADC M
DAA
JNC NEXT
INR B
STA 2007H
MOV A, B
STA 2008H
HLT
(6) To write an 8085 ALP to move a Block of Data from one section of
memory to another section of memory.
LXI H, 2000H
LXI D, 3000H
MOV C, M
MOV A, C
STAX D
INX H
INX D
MOV A, M
STAX D
DCR C
JNZ Loop
HLT
LXI H, 2000H
MOV E, M
MVI D, 00H
INX H
MOV A, M
MVI C, 08H
LXI H, 00H
LOOP: DAD H
RAL
JNC NXT
DAD D
NXT: DCR C
JNZ LOOP
SHLD 2006H
HLT
LXI H, 2000H
MOV A, M
INX H
MOV B, M
MVI C, 00H
RPT: CMP B
JC RSLT
SUB B
INR C
JMP RPT
RSLT: STA 2007H
MOV A, C
STA 2006H
HLT
(8.a) Write an 80850 ALP .to find the largest number in an array.
LXI H, 2000H
MOV C, M
INX H
MOV A, M
DCR C
loop: INX H
CMP M
JNC nxt
MOV A, M
nxt: DCR C
JNZ loop
STA 2100H
HLT
(8.b) Write an 80850 ALP .to find the smallest number in an array.
LXI H, 2000H
MOV C, M
INX H
MOV A, M
DCR C
loop: INX H
CMP M
JC nxt
MOV A, M
nxt: DCR C
JNZ loop
STA 2100H
HLT
SM_NO: MOV C, M
INX H
MOV A, M
DCR C
loop: INX H
CMP M
JC ahd
MOV A, M
ahd: DCR C
JNZ loop
RET
REPL:
MOV C, M
loop1: INX H
CMP M
JZ next
DCR C
JNZ loop1
next: MVI M, 0FFH
RET
LR_NO: MOV C, M
INX H
MOV A, M
DCR C
loop: INX H
CMP M
JNC ahd
MOV A, M
ahd: DCR C
JNZ loop
RET