8085 program to find minimum value of digit in the 8 bit number
Problem – Write an assembly language program in 8085 microprocessor to find minimum value of digit in the 8 bit number.
Example – Assume 8 bit number is stored at memory location 2050, and minimum value digit is stored at memory location 3050.

Algorithm –
- Load the content of memory location 2050 in accumulator A.
- Move the content of A in register B.
- Perform AND operation of content of A with 0F and store the result in A.
- Move the content of A in register C.
- Move the content of B in A.
- Reverse the content of A by using RLC instruction 4 times.
- Perform AND operation of content of A with 0F and store the result in A.
- Compare the contents of A and C by help of CMP C instruction.
- Check if carry flag is set then jump to memory location 2013 otherwise move the content of C in A. Go to memory location 2013.
- Store the value of A in memory location 3050.
Note – CMP C instruction compares the value of A and C. If A>C then carry flag becomes reset otherwise set.
Program –
| MEMORY ADDRESS | MNEMONICS | COMMENT |
|---|---|---|
| 2000 | LDA 2050 | A <- M[2050] |
| 2003 | MOV B, A | B <- A |
| 2004 | ANI 0F | A <- A (AND) 0F |
| 2006 | MOV C, A | C <- A |
| 2007 | MOV A, B | A <- B |
| 2008 | RLC | Rotate content of accumulator right by 1 bit without carry |
| 2009 | RLC | Rotate content of accumulator right by 1 bit without carry |
| 200A | RLC | Rotate content of accumulator right by 1 bit without carry |
| 200B | RLC | Rotate content of accumulator right by 1 bit without carry |
| 200C | ANI 0F | A <- A (AND) 0F |
| 200E | CMP C | A – C |
| 200F | JC 2013 | Jump if CY = 1 |
| 2012 | MOV A, C | A <- C |
| 2013 | STA 3050 | M[3050] <- A |
| 2016 | HLT | END |
Explanation – Registers A, B, C are used for general purpose.
- LDA 2050: loads the contents of memory location 2050 in A.
- MOV B, A: moves the content of A in B.
- ANI 0F: perform AND operation between contents of A and value 0F.
- MOV C, A: moves the content of A in C.
- MOV A, B: moves the content of B in A.
- RLC: shift the content of A left by 1 bit without carry. Use this instruction 4 times to reverse the content of A.
- ANI 0F: perform AND operation between contents of A and value 0F.
- CMP C: compare contents of A, C and update the value of carry flag accordingly.
- JC 2013: jump to memory location 2013 if CY = 1.
- MOV A, C: moves the content of C in A.
- STA 3050: stores the content of A in memory location 3050.
- HLT: stops executing the program and halts any further execution.
Recommended Posts:
- 8085 program to find maximum and minimum of 10 numbers
- 8085 program to find 1’s and 2’s complement of 16-bit number
- 8085 program to find sum of digits of 8 bit number
- 8085 program to find square of a 8 bit number
- 8085 program to find nth power of a number
- 8085 program to find 1's and 2's complement of 8-bit number
- 8085 program to find the factorial of a number
- 8085 program to find square root of a number
- 8085 program to find smallest number between two numbers
- 8085 program to find the sum of a series
- 8085 program to find the set bit of accumulator
- 8085 program to find larger of two 8 bit numbers
- 8085 program to find the element that appears once
- 8085 program to find the sum of series of even numbers
- 8085 program to find maximum of two 8 bit numbers
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



