- Related Questions & Answers
- 8086 program to find the factorial of a number
- Python Program to find the factorial of a number without recursion
- C++ Program to Find Factorial of a Number using Iteration
- C++ Program to Find Factorial of a Number using Recursion
- Java program to find the factorial of a given number using recursion
- 8085 Program to find the smallest number
- C++ Program to Find Factorial of a Number using Dynamic Programming
- C++ program to find first digit in factorial of a number
- 8085 program to find square root of a number
- 8085 program to find nth power of a number
- How to Find the Factorial of a Number using Python?
- Write a Golang program to find the factorial of a given number (Using Recursion)
- Create a procedure to find out the factorial of a number?
- Python Program for factorial of a number
- 8085 program to find square of a 8 bit number

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

In this program we will see how to find the factorial of a number.

Write 8085 Assembly language program to find the factorial of an 8-bit number.

In 8085, there is no direct instruction to perform multiplication. We need to perform repetitive addition to get the result of the multiplication. In each step we are decreasing the value of B and multiply with the previous value of B. We are repeating these steps until B reaches 1. and B – 1 to 0. Thus the factorial is generated.

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

8000 | 05 |

Address | HEX Codes | Labels | Mnemonics | Comments |
---|---|---|---|---|

F000 | 21, 00, 80 | | LXI H, 8000H | Load the number |

F003 | 46 | | MOV B,M | Take number from memory to B |

F004 | 16, 01 | | MVI D, 01H | Set D to 01H |

F006 | CD, 10, F0 | FACT | CALL MUL | Call multiplication |

F009 | 05 | | DCR B | Decrease B by 1 |

F00A | C2, 06, F0 | | JNZ FACT | If Z = 0, jump to Fact |

F00D | 23 | | INX H | Point to next location |

F00E | 72 | | MOV M,D | Store result in memory |

F00F | 76 | | HLT | Terminate the program |

F010 | 58 | MUL | MOV E,B | Load B to E |

F011 | AF | | XRA A | Clear accumulator to store result |

F012 | 82 | ML | ADD D | Add D to A |

F013 | 1D | | DCR E | Decrement E |

F014 | C2, 12, F0 | | JNZ ML | If Z = 0, jump to ML |

F017 | 57 | | MOV D,A | Transfer contents of A to D |

F018 | C9 | | RET | Return result |

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

8001 | 78 |

Advertisements