- Related Questions & Answers
- 8085 Program to find the smallest number
- 8085 program to find larger of two 8 bit numbers
- 8085 program to find maximum of two 8 bit numbers
- 8085 program to find bit differences between two binary patterns.
- 8085 program to subtract two BCD numbers
- Program to Find the smallest number in an array of data in 8085 Microprocessor
- 8085 Program to Add two 8 Bit numbers
- 8085 Program to Subtract two 8 Bit numbers
- 8085 Program to Multiply two 8 bits numbers
- 8085 Program to Divide two 8 Bit numbers
- 8085 program to multiply two 8 bit numbers
- 8085 program to add two 16 bit numbers
- 8085 program to swap two 8-bit numbers
- 8085 Program to Subtract two multi-Byte numbers
- 8085 program to divide two 16 bit numbers

- 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 smallest of two numbers.

Write 8085 Assembly language program to find the smallest number of two 8-bit number stored at location 8000H and 8001H.

This checking is done by using the CMP instruction. This instruction is very similar to the SUB instruction. The only difference is that it does not update the value of Accumulator after executing. So after comparing, if the CY flag is set, it means that the first number is smaller, and the second one is larger

First input

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

. . . | . . . |

8000 | FD |

8001 | 23 |

. . . | . . . |

second input

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

. . . | . . . |

8000 | 59 |

8001 | 75 |

. . . | . . . |

Address | HEX Codes | Label | Mnemonics | Comments |
---|---|---|---|---|

F000 | 21, 00, 80 | LXI H,8000H | Point to the first number | |

F003 | 46 | MOV B,M | Load the first number to B | |

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

F005 | 7E | MOV A,M | Get the second number to A | |

F006 | B8 | CMP B | Compare B with A | |

F007 | DA, 0B, F0 | JC STORE | Is CY = 1,jump to Store | |

F00A | 78 | MOV A,B | Load A with second number | |

F00B | 32, 50, 80 | STORE | STA 8050H | Store the number into memory |

F00E | 76 | HLT | Terminate the program |

First output

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

. . . | . . . |

8050 | 23 |

. . . | . . . |

Second output

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

. . . | . . . |

8050 | 59 |

. . . | . . . |

Advertisements