- 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 find the set bit of accumulator
Here we will see how to find the place of the set bit of the Accumulator data.
Problem Statement
Write 8085 Assembly language program to find the position where the bit is 1. In the accumulator all bits are 0, but only one bit is 1. We have to get the position of the bit which is 1. The position will be displayed in decimal from 1 to 8.
Discussion
We are taking the number like (0010 0000). The place value is 6. So we are rotating the number to the right through carry. If the carry bit is 1, then we break the loop and get the result at memory location F051.
Input
Address | Data |
---|---|
F050 | 20 |
Address | Data |
---|---|
F050 | 80 |
Flow Diagram
Program
Address | HEX Codes | Labels | Mnemonics | Comments |
---|---|---|---|---|
F000 | 3A, 50 F0 | | LDA F050 | Take the number into accumulator into memory |
F003 | 0E, 00 | | MVI C,00H | Clear C flag |
F005 | 1F | LOOP | RAR | Rotate Acc right with carry |
F006 | 0C | | INR C | increase C by 1 |
F007 | D2, 05, F0 | | JNC LOOP | If C is not 1, jump to LOOP |
F00A | 79 | | MOV A,C | Take value from C to A |
F00B | 32, 51, 50 | | STA F051 | Store result into memory |
F00E | 76 | | HLT | Terminate the program |
Output
Address | Data |
---|---|
F051 | 06 |
Address | Data |
---|---|
F150 | 08 |
- Related Articles
- 8085 program to find larger of two 8 bit numbers
- 8085 program to find maximum of two 8 bit numbers
- 8085 program to find square of a 8 bit number
- 8085 program to find sum of digits of 8 bit number
- 8085 program to find minimum value of digit in the 8 bit number
- Golang Program to find the position of the rightmost set bit
- Reset Accumulator (8085 & 8086 microprocessor)
- 8085 program to find bit differences between two binary patterns.
- Instruction to complement Accumulator in 8085 Microprocessor
- Instructions to rotate Accumulator in 8085 Microprocessor
- 8085 Program to Check the fourth bit of a byte
- 8085 program to reverse 8 bit number
- 8085 program to reverse 16 bit number
- 8085 Program to Add two 8 Bit numbers
- 8085 Program to Subtract two 8 Bit numbers

Advertisements