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.
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.
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.
|3003||MOV B, M||46|
|3005||MOV C, M||4E|
|3012||MOV M, A||77|
|3014||MOV M, D||72|
INPUT AND OUTPUT :
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: