MULTIPLY
In 8085 mp there is no multiplication operation. To MULTIPLY TWO 8 BIT NUMBERS STORED IN MEMORY LOCATION we use repetative addition operation
WRITE 8085 ASSEMBLY LANGUAGE PROGRAM TO MULTIPLY TWO 8 BIT NUMBERS STORED IN MEMORY LOCATION AND STORE THE 16 BIT RESULT INTO THE MEMORY WITH CARRY.
THEORY :
In 8085 microprocessor, there is no multiplication operation. To get the result of multiplication, we should use the repetitive addition method. It has dedicated arithmetic instruction for addition, subtraction, increment, and decrement. If we want to perform a multiplication operation then we need a program for doing the repeated addition.
ALGORITHM :
Step 1: LXI H,2000h, to load the address in H-L register pair using LXI H from 16-bit location 2000h.
Step 2: MOV B, M to move the value of 2000h memory address value into the register B.
Step 3: INX H, to increase the value of the H-L register pair to get the next memory location.
Step 4: MOV C, M to move the value of the 2001h memory location to register C.
Step 5: XRA A; to make sure and turn the value of the accumulator to zero by X-OR operation.
Step 6: XRA D; to make sure and turn the value of the D register to zero by X-OR operation.
Step 7: ADD B, for we need to perform addition with the value of accumulator with the content of B register and store the result into the accumulator.
Step 8: JNC; to jump on no carry to the mentioned location at step 10.
Step 9: INR D; To increment the D register.
Step 10: DCR C, To decrement the value of the C register.
Step 11: JNZ to make a loop and back to step 6.
Step 12: INX H, done to the H-L pair of the register will be increased and pointed to store the addition result.
Step 13: MOV M, A; to store the value of the accumulator into a memory location in 2002h.
Step 14: INX H; to increment the HL register pair to store the value.
Step 15: MOV M, D; To store the value of multiplication value(carry value).
Step 16: HLT; to stop the program.
IMPLEMENTATION :
Location | Mnemonics | Hex Code |
---|---|---|
3000 | LXI H | 21 |
3001 | 00 | 00 |
3002 | 20 | 20 |
3003 | MOV B, M | 46 |
3004 | INX H | 23 |
3005 | MOV C, M | 4E |
3006 | XRA A | AF |
3007 | XRA D | AA |
3008 | ADD B | 80 |
3009 | JNC | D2 |
300A | 0D | 0D |
300B | 30 | 30 |
300C | INR D | 14 |
300D | DCR C | 0D |
300E | JNZ | C2 |
300F | 08 | 08 |
3010 | 30 | 30 |
3011 | INX H | 23 |
3012 | MOV M, A | 77 |
3013 | INX H | 23 |
3014 | MOV M, D | 72 |
3015 | HLT | 76 |
INPUT AND OUTPUT :
Location | Input |
---|---|
2000 | FF |
2001 | FF |
Location | Output |
---|---|
2002 | 01 |
2003 | FE |
DISCUSSION :
In this program, We store the carry bit ( another 8-bit) that can be stored in 2002h memory location. In this example carry value is 01h. Inputed values are FFh and FFh respectively. According the input, output is generated.
YOU MIGHT LIKE:
FAQ:
Which of the following is a 2nd generation of compute?
A - Vaccume tube
B - Microprocessor
C - Intigrated circuit (IC)
D - Transistor
ANS: D
EXPLANATION:
1 First Generation The period of the first generation: 1946-1959. Vacuum tube-based.
2 Second Generation The period of the second generation: 1959-1965. Transistor-based.
3 Third Generation The period of the third generation: 1965-1971. Integrated Circuit based.
4 Fourth Generation The period of fourth-generation: 1971-1980. VLSI microprocessor-based.
5 Fifth Generation The period of fifth-generation: 1980-onwards. ULSI microprocessor-based.
What is the first microprocessor invented?
Ans: Intel 4004 in 1971.
Comments
Post a Comment