- Related Questions & Answers
- C Program for Tower of Hanoi
- C++ Program for Dijkstra’s shortest path algorithm?
- C/C++ Program for nth Catalan Number?
- C Program to Multiply two Floating Point Numbers?
- C program to find the length of a string?
- C Program to Check if all digits of a number divide it
- C Program to Check if a Given String is a Palindrome?
- Write a program to Delete a Tree in C programming
- Write a C program to print “ Tutorials Point ” without using a semicolon
- Sum of the nodes of a Singly Linked List in C Program
- Sum of first n natural numbers in C Program
- C Program for simple interest?
- Area of a n-sided regular polygon with given Radius in C Program?
- Area of a leaf inside a square in C Program?
- C Program for Area of a square inscribed in a circle which is inscribed in a hexagon?

- 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