Quick links
Latest articles
Internship
Members
New...
Algorithms
Discrete Mathematics
Big data
Languages
C
C++
C++ STL
Java
Data Structure
C#.Net
Android
Kotlin
SQL
Web
PHP
Python
JavaScript
CSS
Ajax
Node.js
Web prog.
Programs
C
C++
DS
Java
C#
Python
Aptitude
C
C++
Java
DBMS
Interview
C
Embedded C
Java
SEO
HR
CS Subjects
CS Basics
O.S.
Networks
DBMS
Embedded Systems
Cloud Computing
Machine learning
CS Organizations
Linux
DOS
More...
Articles
Puzzles
News/Updates

Home » Embedded Systems

Find addition of two 8-bit BCD numbers | 8086 Microprocessor



Here, we are going to learn how to find addition of two 8-bit BCD numbers on 8085 microprocessor?
Submitted by Ayush Sharma, on November 05, 2018

Problem statement:

Write a program in 8086 microprocessor to find out the addition of two 8-bit BCD numbers, where numbers are stored from starting memory address 2000 : 500 and store the result into memory address 2000 : 600 and carry at 2000 : 601.

Algorithm:

  1. Load data from offset 500 to register AL (first number)
  2. Load data from offset 501 to register BL (second number)
  3. Add these two numbers (contents of register AL and register BL)
  4. Apply DAA instruction (decimal adjust)
  5. Store the result (content of register AL) to offset 600
  6. Set register AL to 00
  7. Add contents of register AL to itself with carry
  8. Store the result (content of register AL) to offset 601
  9. Stop

Program:

ADDRESSMNEMONICSCOMMENTS
400MOV AL, [500]AL ← [500]
404MOV BL, [501]BL ← [501]
408ADD AL, BLAL ← AL+BL
40ADAADECIMAL ADJUST AL
40BMOV [600], ALAL → [600]
40FMOV AL, 00AL ← 00
411ADC AL, ALAL ← AL+AL+cy(prev)
413MOV [601], ALAL → [601]
417HLTEND

Explanation:

  1. MOV AL, [500]: load data from offset 500 to register AL
  2. MOV BL, [501]: load data from offset 501 to register BL
  3. ADD AL, BL: ADD contents of registers AL AND BL
  4. DAA: decimal adjust AL
  5. MOV [600], AL: store data from register AL to offset 600
  6. MOV AL, 00: set value of register AL to 00
  7. ADC AL, AL: add contents of register AL to AL with carry
  8. MOV [601], AL: store data from register AL to offset 601
  9. HLT: stop





Quick links:
C FAQ(s) C Advance programs C/C++ Tips & Tricks Puzzles JavaScript CSS Python Linux Commands PHP Android Articles More...

Featured post:
Introduction to Linux (Its modes, Safety, Most popular Applications)
Linux Best Distribution Software (Distros) of 2018

Was this page helpful? Please share with your friends...

Are you a blogger? Join our Blogging forum.

Comments and Discussions



Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing » Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates



© https://www.includehelp.com (2015-2018), Some rights reserved.