Lab_5
Lab_5
Lab: 5
Familiarization with miscellaneous problems
Miscellaneous problems
8085 microprocessor do not have instructions for the multiplication and division. So some algorithm has to be devised for
the multiplication and division using the available instructions. Similarly using 8085’s instruction set it is possible to write
programs to solve various types of problems.
a) Multiplying 8-bit numbers
The multiplication of two unsigned 8-bit numbers can be done in two ways a) repetitive addition or use of a register
shifting operation.
Repetitive addition is the most straight forward method. For example, if we want to multiply 12 times 8 we have to add
12 to the initially zeroed accumulator 8 times.
Shift operation provides faster multiplication and division. Shifting a byte left one bit is equivalent to multiplying by 2,
while shifting a byte right one bit is equivalent to dividing by 2.
The three parts of multiplication problems are:
MULTILICAND
MULTIPLIER
PRODUCT
E.g., 03 (multiplicand)
02 (multiplier)
06 (product)
Multiplying 8-bit number using repetitive addition
Note: Do not forget to initialize output ports if out instruction is used.
Run this program in full speed and see the output in the port A. What will happen if the value in the reg. B is changed?
Modify the program when the result exceeds 8-bit.
1
Microprocessor for BEX/BCT/BEL @ IOE, Pulchowk Campus
c) Miscellaneous problems
In this section, different problems are given so that student will be familiar with different types of the situations in
programming 8085. At this point it is assumed that almost all of the instructions of 8085 microprocessor are already
familiar.
Delay Loop:
Load the following program
8000 MVI A 01
8002 OUT 40
8004 INR A
8005 NOP
8006 NOP
8007 NOP
8008 JMP 8002
Run the program and run in full speed. Observe the output at port A.
Modify the above program as following to call the subroutine at 8050
8000 MVI A 01 8050 MVI B 80
8002 OUT 40 8052 MVI C 80
8004 INR A 8054 DCR C
8005 CALL 8050 8055 JNZ 8054
8008 JMP 8002 8058 DCR B
8059 JNZ 8052
805C RET
Again run the program in full speed, and observe the output at port A. Compare the result with previous case.
Here the subroutine is used to make a delay in between two successive displays. The delay calculation is as follows:
2
Lab Sheet for Microprocessor for BEX/BCT/BEL @ IOE, Pulchowk Campus
Optional Assignments:
7. A table contains ten 8-bit numbers from memory location 9500H; write a program to arrange in ascending order.
8. Write a program at memory location FE00H, which resets all memory starting from 8000H to FE00H.
Modify the above program to set 01H to all memory location.
Write programs for each of the assignments. After completing the execution show the output to the instructor.