Programs Questions
Programs Questions
Programs Questions
3. Sample Problem:
( 4 0 0 0 H ) = 1 4 H
( 4 0 0 1 H ) = 8 9 H
R e s u l t = 1 4 H + 8 9 H = 9 D H
4. Subtract the contents of memory location 4001H from the memory location 2000H and
place the result in memory location 4002H.
5. Add the 16-bit number in memory locations 4000H and 4001H to the 16-bit number in
memory locations 4002H and 4003H. The most significant eight bits of the two numbers
to be added are in memory locations 4001H and4003H. Store the result in memory
locations 4004H and 4005H with the most significant byte in memory location 4005H.
6. Add the contents of memory locations 40001H and 4001H and place the result in the
memory locations 4002Hand 4003H.
7. Subtract the 16-bit number in memory locations 4002H and 4003Hfrom the 16-bit number
in memory locations 4000H and 4001H. The most significant eight bits of the two
numbers are in memory locations 4001H and 4003H.Store the result in memory locations
4004H and 4005H with the most significant byte in memory location 4005H.
8. Find the l's complement of the number stored at memory location4400H and store the
complemented number at memory location 4300H
9. Find the 2's complement of the number stored at memory location4200H and store the
complemented number at memory location 4300H.
10. Pack the two unpacked BCD numbers stored in memory locations4200H and 4201H and
store result in memory location 4300H. Assume the least significant digit is stored at
4200H.
11. Two digit BCD number is stored in memory location 4200H.Unpack the BCD number and
store the two digits in memory locations 4300H and4301H such that memory location
4300H will have lower BCD digit.
12. Read the program given below and state the contents of all registers after the execution of
each instruction in sequence.
Main program:
4000H LXI SP, 27FFH
4003H LXI H, 2000H
4006H LXI B, 1020H
4009H CALL SUB
400CH HLT
Subroutine program:
4100H SUB: PUSH B
4101H PUSH H
4102H LXI B, 4080H
4105H LXI H, 4090H
4108H SHLD 2200H
4109H DAD B
410CH POP H
410DH POP B
410EH RET
13. Write a program to shift an eight bit data four bits right. Assume that data is in register C
14. Program to shift a 16-bit data 1 bit left. Assume data is in the HL register pair
15. Write a set of instructions to alter the contents of flag register in8085
16. Calculate the sum of series of numbers. The length of the series is in memory location
4200H and the series begins from memory location 4201H.
a. Consider the sum to be 8 bit number. So, ignore carries. Store the sum at memory
location 4300H.
b. Consider the sum to be 16 bit number. Store the sum at memory locations 4300H and
4301H
17. Multiply two 8-bit numbers stored in memory locations 2200H and2201H by repetitive
addition and store the result in memory locations 2300H and2301H
18. Divide 16 bit number stored in memory locations 2200H and 2201Hby the 8 bit number
stored at memory location 2202H. Store the quotient in memory locations 2300H and
2301H and remainder in memory locations 2302H and 2303H.
19. Find the number of negative elements (most significant bit 1) in a block of data. The
length of the block is in memory location 2200H and the block itself begins in memory
location 2201H. Store the number of negative elements in memory location 2300H
20. Find the largest number in a block of data. The length of the block is in memory location
2200H and the block itself starts from memory location 2201H.Store the maximum
number in memory location 2300H. Assume that the numbers in the block are all 8 bit
unsigned binary numbers.
21. Write a program to count number of l's in the contents of D register and store the count in
the B register.
22. Write a program to sort given 10 numbers from memory location2200H in the ascending
order.
23. Search the given byte in the list of 50 numbers stored in the consecutive memory locations
and store the address of memory location in the memory locations 2200H and 2201H.
Assume byte is in the C register and starting address of the list is 2000H. If byte is not
found store 00 at 2200H and 2201H.
24. Add 2 arrays having ten 8-bit numbers each and generate a third array of result. It is
necessary to add the first element of array 1 with the first element of array-2 and so on.
The starting addresses of array l, array2 and array3are 2200H, 2300H and 2400H,
respectively.
25. Write an assembly language program to separate even numbers from the given list of 50
numbers and store them in another list starting from 2300H. Assume starting address of 50
number list is 2200H.
26. Write assembly language program with proper comments for the following: A block of
data consisting of 256 bytes is stored in memory starting at 3000H.This block is to be
shifted (relocated) in memory from 3050H onwards. Do not shift the block or part of the
block anywhere else in the memory.
27. Add even parity to a string of 7-bit ASCII characters. The length of the string is in
memory location 2040H and the string itself begins in memory location 2041H. Place
even parity in the most significant bit of each character
28. A list of 50 numbers is stored in memory, starting at 6000H. Find number of negative,
zero and positive numbers from this list and store these results in memory locations
7000H, 7001H, and 7002H respectively.
29. Multiply the 8-bit unsigned number in memory location 2200H by the 8-bit unsigned
number in memory location 2201H. Store the 8 least significant bits of the result in
memory location 2300H and the 8 most significant bits in memory location 2301H.
30. Divide the 16-bit unsigned number in memory locations 2200H and2201H (most
significant bits in 2201H) by the B-bit unsigned number in memory location 2300H store
the quotient in memory location 2400H and remainder in2401H.
31. DAA instruction is not present. Write a sub routine which will perform the same task as
DAA.