- 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 find sum of digits of 8 bit number
In this program we will see how to add the digits of an 8-bit number.
Problem Statement
Write 8085 Assembly language program to add the digits of an 8-bit number stored in memory location 8000H.
Discussion
To get the digits of an 8-bit number, we can use the masking operation. At first we will mask the upper nibble, and then the lower nibble. After masking the lower nibble, we have to rotate it to the right to make it least significant nibble. Then we can simply add it to the stored nibble to get the sum.
Input
Address | Data |
---|---|
... | ... |
8000 | 8A |
... | ... |
Program
Address | HEX Codes | Mnemonics | Comments |
---|---|---|---|
F000 | 3A, 00, 80 | LDA 8000H | Load the number into A |
F003 | 4F | MOV C, A | Copy the number to C |
F004 | E6, 0F | ANI 0FH | Take the lower nibble |
F006 | 47 | MOV B, A | Store the result into B |
F007 | 79 | MOV A, C | Restore the actual number |
F008 | E6, F0 | ANI F0 | Take the upper nibble |
F00A | 0F | RRC | Rotate the bits four times |
F00B | 0F | RRC | |
F00C | 0F | RRC | |
F00D | 0F | RRC | |
F00E | 80 | ADD B | Add A with B |
F00F | 32, 50, 80 | STA 8050H | Store the result at 8050H |
F012 | 76 | HLT | Terminate the program |
Output
Address | Data |
---|---|
... | ... |
8050 | 12 |
... | ... |
- Related Articles
- 8086 program to find sum of digits of 8 bit number
- 8085 program to find square of a 8 bit number
- 8085 program to reverse 8 bit number
- 8085 program to sum of two 8 bit numbers without carry
- 8085 program to find minimum value of digit in the 8 bit number
- 8085 program to find larger of two 8 bit numbers
- 8085 program to find maximum of two 8 bit numbers
- 8085 Program to Divide a 16-bit number by an 8-bit number
- 8085 program to count number of once in the given 8-bit number
- 8085 program to perform AND operation in nibbles of 8 bit number
- 8085 program to convert an 8 bit number into Grey number
- 8085 program to show masking of lower and higher nibbles of 8-bit number
- 8085 program to find 1's and 2's complement of 8-bit number
- 8085 program to convert 8 bit BCD number into ASCII Code
- Program for adding 4 hex digits of a 16-bit number in 8085 Microprocessor

Advertisements