- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
8085 Program to multiply two 8-bit numbers (shift and add method)
Now let us see a program of Intel 8085 Microprocessor. In this program we will see how to multiply two numbers using shift and add methods.
Problem Statement:
Write 8085 Assembly language program to multiply two 8-bit numbers using shift and add method.
Discussion:
The shift and add method is an efficient process. In this program, we are taking the numbers from memory location 8000H and 8001H. The 16 bit results are storing into location 8050H onwards.
In this method we are putting the first number into DE register pair. The actual number is placed at E register, and D is holding 00H. The second number is taken into A. As the numbers are 8-bit numbers, then we are shifting the Accumulator contents eight times. When the carry flag is set while rotating, then the DE content is added with HL. Initially HL pair will hold 0000H. Then HL is also added with HL itself. Thus the result will be generated.
Input:
Address | Data |
---|---|
. . . | . . . |
8000 | 25 |
8001 | 2A |
. . . | . . . |
Flow Diagram:
Program:
Address | HEX Codes | Labels | Mnemonics | Comments |
---|---|---|---|---|
F000 | 21, 00, 80 | LXI H,8000H | Point to first operand | |
F003 | 5E | MOV E,M | Load the first operand to E | |
F004 | 16, 00 | MVI D,00H | Clear the register D | |
F006 | 23 | INX H | Point to next location | |
F007 | 7E | MOV A,M | Get the next operand | |
F008 | 0E, 08 | MVI C,08H | Initialize counter with 08H | |
F00A | 21, 00, 00 | LXI H, 0000H | Clear the HL pair | |
F00D | 0F | LOOP | RRC | Rotate the acc content to right |
F00E | D2, 12, F0 | JNC SKIP | If carry flag is 0, jump to skip | |
F011 | 19 | DAD D | Add DE with HL | |
F012 | EB | SKIP | XCHG | Exchange DE and HL |
F013 | 29 | DAD H | Add HL with HL itself | |
F014 | EB | XCHG | Exchange again the contents of DE and HL | |
F015 | 0D | DCR C | Decrease C register | |
F016 | C2, 0D, F0 | JNZ LOOP | if Z = 0, jump to LOOP | |
F019 | 22, 50, 80 | SHLD 8050H | Store the result | |
F01C | 76 | HLT | Terminate the program |
Output:
Address | Data |
---|---|
. . . | . . . |
8050 | 12 |
8051 | 06 |
. . . | . . . |
- Related Articles
- Program to multiply two 8-bit numbers (shift and add method) in 8085 Microprocessor
- 8085 program to multiply two 8 bit numbers
- 8085 Program to Add two 8 Bit numbers
- 8085 program to multiply two 8 bit numbers using logical instructions
- Program to Add two 8 Bit numbers in 8085 Microprocessor
- 8085 Program to multiply two 16-bit binary numbers
- 8051 Program to Multiply two 8 Bit numbers
- 8086 program to multiply two 8-bit numbers
- 8085 program to add two 16 bit numbers
- 8085 Program to Subtract two 8 Bit numbers
- 8085 Program to Divide two 8 Bit numbers
- 8085 program to swap two 8-bit numbers
- 8085 Program to Multiply two 8 bits numbers
- Program to multiply two 16-bit binary numbers in 8085 Microprocessor
- 8051 Program to Add two 8 Bit numbers
