2. 4/5/2023 2
EX.1
• Write an 8085-assembly language
program to add two 8-bit numbers
stored in memory locations 2000H and
2001H and store the result in memory
location 2002H.
3. Sol 1.
4/5/2023 3
LXI H, 2000H ; Load the address of the first number into the H-L pair
MOV A, M ; Move the first number into the accumulator
INX H ;
ADI M ; Add the second number to the accumulator
STA 2002H ; Store the result in memory location 2002H
HLT ; Halt the program
4. 4/5/2023 4
EX.2
• Write an 8085-assembly language program to find
the largest number from a given array of 5 numbers
stored in memory locations 2000H to 2004H. Store
the largest number in memory location 2005H.
Assume that the numbers are signed and stored in
2's complement representation.
5. Sol 2.
4/5/2023 5
LXI H, 2000H ; Load the starting address of the array into H-L pair
MOV A, M ; Move the first number into accumulator
MOV B, A ; Move the first number into the B register for comparison
INX H ; Move to the next number in the array
MOV A, M ; Move the second number into accumulator
CMP B ; Compare the second number with the largest number stored in B
JC SKIP ; Jump if carry (i.e., if the second number is less than the largest number)
MOV B, A ; Move the second number into B if it is larger
SKIP: INX H ; Move to the next number in the array
MOV A, M ; Move the next number into accumulator
CMP B ; Compare it with the current largest
JNC CONTINUE ; If the current largest is greater or equal, move on to the next number
MOV B, A ; If accumulator is greater, set it as the new largest
CONTINUE:DCR C ; Decrement the counter
JNZ SKIP ; Jump to the skip loop if not zero, i.e., we have more numbers to process
MOV A, B ; Move the largest number stored in B into the accumulator
STA 2005H ; Store the largest number in memory location 2005H
HLT ; Halt the program
6. 4/5/2023 6
EX.2
• An 8085-assembly language program is given below.
MVI A, B5H
MVI B, 0EH
XRI 69H
ADD B
ANI 9BH
CPI 9FH
STA 3010H
HLT
• After execution of the program line, what will the
flags' status be?