# 8085 program to find maximum of two 8 bit numbers

**Problem –** Write a assembly language program to find maximum of two 8 bit numbers in 8085 microprocessor.

**Assumptions –** Starting memory locations and output memory locations are 2050, 2051 and 3050 respectively.

**Example –**

**Algorithm –**

- Load value in the accumulator
- Then, copy the value to any of the register
- Load next value in the accumulator
- Compare both values
- Check carry flag, if reset then jump to the required address to store the value
- Copy the result in the accumulator
- Store the result at the required address

**Program –**

MEMORY ADDRESS | MNEMONICS | COMMENTS |
---|---|---|

2000 | LDA 2050 | A<-25 |

2003 | MOV B, A | B<-25 |

2004 | LDA 2051 | A<-15 |

2007 | CMP B | A-B |

2008 | JNC 200C | Jump if Carry flag is Reset(Carry flag = 0) |

200B | MOV A, B | A<-25 |

200C | STA 3050 | 3050<-25 |

200F | HLT | Terminates the program |

**Explanation –**

**LDA 2050:**loads value at memory location 2050**MOV B, A:**assigns value of A to B**LDA 2051:**loads value at memory location 2051**CMP B:**compare values by subtracting B from A**JNC 200C:**jump at memory location 200C if carry flag is Reset(Carry flag = 0)**STA 3050:**store result at memory location 3050**HLT:**terminates the program

## Recommended Posts:

- 8085 program to find maximum and minimum of 10 numbers
- 8085 program to find the sum of series of even numbers
- 8085 program to find larger of two 8 bit numbers
- 8085 program to find the sum of first n natural numbers
- 8085 program to find smallest number between two numbers
- 8085 program to count total odd numbers in series of 10 numbers
- 8085 program to count total even numbers in series of 10 numbers
- 8085 program to add two 16 bit numbers
- 8085 program to add two 8 bit numbers
- 8085 program to add 2-BCD numbers
- 8085 program to multiply two 16-bit numbers
- 8085 program to swap two 8-bit numbers
- 8085 program to sum of two 8 bit numbers without carry
- 8085 program to divide two 16 bit numbers
- 8085 program to multiply 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.