AIM:
To perform the multiplication of two 8 bit numbers using 8085.
ALGORITHM:
1) Start the program by loading HL register pair with address of memory location.
2) Move the data to a register (B register).
3) Get the second data and load into Accumulator.
Add the two register contents
4) Check for carry.
Increment the value of carry.
5) Check whether repeated addition is over and store the value of product and carry
in memory location.
6) Terminate the program.
PROGRAM:
MVI D,00 Initialize register D to 00
MVI A,00 Initialize Accumulator content to 00
LXI H,4150
MOV B,M Get the first number in B - reg
INX H
MOV C,M Get the second number in C- reg.
LOOP: ADD B Add content of A - reg to register B.
JNC NEXT Jump on no carry to NEXT.
INR D Increment content of register D
NEXT: DCR C Decrement content of register C.
JNZ LOOP Jump on no zero to address
STA 4152 Store the result in Memory
MOV A, D
STA 4153 Store the MSB of result in Memory
HLT Terminate the program.
OBSERVATION:
FF (4150)
Input:
FF (4151)
01 (4152)
Output:
FE (4153)
RESULT:
Thus the program to multiply two 8-bit numbers was executed.
it is easy
ReplyDeleteit is easy
ReplyDeleteCan't we use ANA operator??
ReplyDeleteThis comment has been removed by the author.
ReplyDeletesee this efficient and Simple
ReplyDeleteMVI A 00h
LXI H 8061h
MOV B M
INX H
MOV C M
L2: ADD B
DCR C
JNZ L2
STA 8070h
HLT
Its simple and better
Deletedoesnt work for carry though
Deletedoesnt work for carry but very simple for small bit data
Deletethat was good
ReplyDelete