![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
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
8086 program to convert ASCII to BCD number
In this program we will see how to find the equivalent BCD number from an ASCII value.
Problem Statement
Write 8086 Assembly language program to find the equivalent BCD number from an ASCII value. The number is stored at memory location 2050 and store the result at memory location 3050.
Discussion
This program can change ASCII value of a number to its BCD (Decimal) form. The ASCII values of the numbers are like below:
ASCII (in Hex) | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 |
---|---|---|---|---|---|---|---|---|---|---|
BCD | 00 | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 |
From this table we can easily find that the last nibble of the ASCII value is actually the BCD equivalent. So to take the last nibble we have masked the upper nibble, and take the lower nibble as result.
Input
Address | Data |
---|---|
… | … |
2050 | 39 |
… | … |
Flow Diagram
Program
Output
Address | Data |
---|---|
… | … |
3050 | 09 |
… | … |
Advertisements