- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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 add two 16 bit numbers
In this program we will see how to add two 16-bit numbers.
Problem Statement
Write8085 Assembly language program to add two 16-bit number stored in memory location 8000H – 8001H and 8002H – 8003H.
Discussion
In this program we are pointing the operand addresses using HL and DE register pair. Then adding LSBytes by ADD operator, and after that adding MSBytes using ADC operator to consider the carry flag result. The 16-bit result will be stored at BC register, and by checking the carry bit after addition we can simply put 1 into memory.
We are taking two numbersBCAD + FE2D = 1BADA
Input
Address | Data |
---|---|
... | ... |
8000 | AD |
8001 | BC |
8002 | 2D |
8003 | FE |
... | ... |
Flow Diagram
Program
Address | HEX Codes | Labels | Mnemonics | Comments |
---|---|---|---|---|
F000 | 21, 00, 80 | LXI H,8000H | Point to LSB of first operand | |
F003 | 11, 02, 80 | LXI D,8002H | Point to LSB of second address | |
F006 | 1A | LDAX D | Load Acc with content pointed by DE | |
F007 | 86 | ADD M | Add memory element pointed by HL with Acc | |
F008 | 4F | MOV C, A | Store LSB result at C | |
F009 | 23 | INX H | Point to next byte of first operand | |
F00A | 13 | INX D | Point to next byte of second operand | |
F00B | 1A | LDAX D | Load Acc with content pointed by DE | |
F00C | 8E | ADC M | Add memory element pointed by HL with Acc+ Carry | |
F00D | 47 | MOV B,A | Store the MSB at B | |
F00E | 60 | MOV H,B | Move B to H | |
F00F | 69 | MOV L,C | Move C to L | |
F010 | 22, 50, 80 | SHLD 8050H | Store the result at 8050H and 8051H | |
F013 | D2, 1B, F0 | JNC DONE | Skip to end | |
F016 | 3E, 01 | MVI A, 01H | Load 1 to Acc | |
F018 | 32, 52, 80 | STA 8052H | Store Acc content into 8052H | |
F01B | 76 | DONE | HLT | Terminate the program |
Output
Address | Data |
---|---|
... | ... |
8050 | DA |
8051 | BA |
8052 | 01 |
... | ... |
- Related Articles
- 8085 program to divide two 16 bit numbers
- 8085 Program to multiply two 16-bit binary numbers
- 8085 Program to Add two 8 Bit numbers
- 8085 program to add three 16 bit numbers stored in registers
- Program to multiply two 16-bit binary numbers in 8085 Microprocessor
- Program to Add two 8 Bit numbers in 8085 Microprocessor
- 8085 program to swap two 16-bit numbers using Direct addressing mode
- 8086 program to add two 16 bit BCD numbers with carry
- 8085 Program to multiply two 8-bit numbers (shift and add method)
- 8086 program to add two 16-bit numbers with or without carry
- 8085 Program to Subtract two 8 Bit numbers
- 8085 Program to Divide two 8 Bit numbers
- 8085 program to multiply two 8 bit numbers
- 8085 program to swap two 8-bit numbers
- 8086 program to multiply two 16-bit numbers

Advertisements