January 24, 2012
Write a program to multiply 05 by 08 using the technique of repeated addition and store output at external memory 3020H.
Apparatus Used: Microprocessor kit, Keyboards
Assumption: Multiplication can be achieved by adding the multiplicand repeatedly as many times as the multiplier. As 05*08
05+05+05+05+05+05+05+05=40
Algorithm:
- Clear the accumulator.
- Load 1 Number in Register C.
- Load Second Number in Register B.
- Add B into Accumulator.
- Decrement counter by one.
- Check counter is zero or not. If counter is not zero repeat addition.
- Store output at given location.
Program:
Memory Add
|
Mnemonics
|
Op-code
|
Comments
|
2000
|
MVI
|
A, 00 H
|
Clear the accumulator
|
2002
|
MVI
|
C, 05 H
|
Multiplier is placed in C
|
2004
|
MVI
|
B, 08 H
|
Multiplicand placed in B
|
2006
|
ADD
|
B
|
Add Multiplicand to the Accumulator
|
2007
|
DCR
|
C
|
Decrement counter by one
|
2008
|
JNZ
|
2005
|
Repeat until the value of C=0
|
200B
|
STA
|
2052
|
Store output
|
200E
|
RST
|
5
|
Set Break-point
|
200F
|
END
|
End the program
|
Description of used instruction:
MVI: This instruction is used to store 8 bit data in specified register.
ADD: This instruction is used to add the content of specified register to the content of accumulator and store output in accumulator.
DCR: This instruction is used decrement the content of specified register by 1.
JNZ: If result is not zero it will jump to the target address.
STA: This instruction is used to store the content of accumulator at specified memory address.
RST 5: This instruction is used to set break-point for the execution.
END: This instruction is used to execute the program.
Result:
Output: A=05*08=40 (28) H and it will store at external memory 2052H.
Procedure to look output
- After press ENTER, You will get first screen
- Press G and Provide Initial address (as 2000)
- Press SHIFT+4,You will get first screen again
- Press M and Provide address for output (M2052) and press ENTER
- You will get your desired output.
Subscribe to:
Post Comments (Atom)
It is peгfect timе to make a fеw plans for the future and it's time to be happy.
ReplyDeleteI've learn this рօst ɑnd if I could I desire to recommend you some attention-grabbing things or advice.
Mаybe you can write next artiсles relatinɡ to this article.
I desire to larn more thiոgs about it!
my hߋmepage - Maillot de foot Enfant