- 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 2-digit BCD numbers
Now let us see a program of Intel 8085 Microprocessor. This program will find the multiplication result of two BCD numbers.
Problem Statement
Write 8085 Assembly language program to find two BCD number multiplication. The numbers are stored at location 8000H and 8001H.
Discussion
In this program the data are taken from 8000H and 8001H. The result is stored at location 8050H and 8051H.
As we know that 8085 has no multiply instruction so we have to use repetitive addition method. In this process after each addition we are adjusting the accumulator value to get decimal equivalent. When carry is present, we are incrementing the value of MS-Byte. We can use INR instruction for incrementing, but here ADI 01H is used. The INR instruction does not affect the CY flag so we need ADI instruction.
Input
first input
Address | Data |
---|---|
. . . | . . . |
8000 | 12 |
8001 | 20 |
. . . | . . . |
second input
Address | Data |
---|---|
. . . | . . . |
8000 | 27 |
8001 | 03 |
. . . | . . . |
Flow Diagram
Program
Address | HEX Codes | Labels | Mnemonics | Comments |
---|---|---|---|---|
F000 | 21, 00, 80 | LXI H,8000H | Load first operand address | |
F003 | 46 | MOV B, M | Store first operand to B | |
F004 | 23 | INX H | Increase HLpair | |
F005 | 4E | MOV C, M | Store second operand to register C | |
F006 | 1E, 00 | MVI E, 00H | Clear register E | |
F008 | 63 | MOV H, E | Clear H register | |
F009 | 7B | MOV A, E | Clear A register | |
F00A | B9 | CMP C | Compare C with A | |
F00B | CA, 23, F0 | JZ DONE | When Z = 0,jump to DONE | |
F00E | 80 | LOOP | ADD B | Add B with A |
F00F | 27 | DAA | Decimal Adjust | |
F010 | 57 | MOV D, A | Store A to D | |
F011 | D2, 19, F0 | JNC NINC | Jump tp NINC | |
F014 | 7C | MOV A, H | Store H to A | |
F015 | C6, 01 | ADI 01H | Increase A by1 | |
F017 | 27 | DAA | DecimalAdjust | |
F018 | 67 | MOV H, A | Restore H from A | |
F019 | 7B | NINC | MOV A, E | Load E to A |
F01A | C6, 01 | ADI 01H | Increase A by1 | |
F01C | 27 | DAA | Decimal adjust | |
F01D | 5F | MOV E, A | Restore E from A | |
F01E | B9 | CMP C | Compare C with A | |
F01F | 7A | MOV A,D | Load D to A | |
F020 | C2, 0E, F0 | JNZ LOOP | Jump to LOOP | |
F023 | 6F | DONE | MOV L, A | Load A to L |
F024 | 22, 50, 80 | SHLD 8050H | Store HL pair at location 8050 and 8051 | |
F027 | 76 | HLT | Terminate the program |
Output
first output
Address | Data |
---|---|
. . . | . . . |
8050 | 40 |
8051 | 02 |
. . . | . . . |
second output
Address | Data |
---|---|
. . . | . . . |
8050 | 81 |
8051 | 00 |
. . . | . . . |
- Related Articles
- Program to multiply two 2-digit BCD numbers in 8085 Microprocessor
- 8085 program to subtract two BCD numbers
- 8085 program to add 2-BCD numbers
- 8085 Program to convert a two-digit BCD to binary
- 8085 Program to Add two multi-byte BCD numbers
- 8085 Program to Multiply two 8 bits numbers
- 8085 program to multiply two 8 bit numbers
- 8085 Program to multiply two 16-bit binary numbers
- 8085 Program to Multiply two numbers of size 8 bits
- Program to multiply two 16-bit binary numbers in 8085 Microprocessor
- 8085 program to multiply two 8 bit numbers using logical instructions
- 8085 Program to multiply two 8-bit numbers (shift and add method)
- BCD numbers in 8085 Microprocessor
- 8085 Program for subtraction of multi-Byte BCD numbers
- 8085 program with a subroutine to add ten packed BCD numbers.
