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.
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.


