- Related Questions & Answers
- 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
- Golang Program to find the position of the rightmost set bit
- 8085 program to find sum of digits of 8 bit number
- 8085 program to find minimum value of digit in the 8 bit number
- 8085 Program to Check the fourth bit of a byte
- Instruction to complement Accumulator in 8085 Microprocessor
- Instructions to rotate Accumulator in 8085 Microprocessor
- 8085 program to find bit differences between two binary patterns.
- Reset Accumulator (8085 & 8086 microprocessor)
- 8085 program to reverse 8 bit number
- 8085 program to reverse 16 bit number
- Find position of the only set bit in C++
- Accumulator or Register A in 8085 Microprocessor

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

Here we will see how to find the place of the set bit of the Accumulator data.

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.

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.

Address | Data |
---|---|

F050 | 20 |

Address | Data |
---|---|

F050 | 80 |

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 |

Address | Data |
---|---|

F051 | 06 |

Address | Data |
---|---|

F150 | 08 |

Advertisements