- Related Questions & Answers
- 8085 program to find maximum of two 8 bit numbers
- 8085 program to count total even numbers in series of 10 numbers
- 8085 program to count total odd numbers in series of 10 numbers
- Java program to find maximum of three numbers
- C Program to Minimum and Maximum prime numbers in an array
- 8085 Program to Exchange 10 bytes
- C# program to find the maximum of three numbers
- Python program to find the maximum of three numbers
- C# program to find maximum and minimum element in an array
- 8085 program to find larger of two 8 bit numbers
- 8085 program to find the sum of series of even numbers
- 8085 program to find the sum of first n natural numbers
- 8085 program to find smallest number between two numbers
- 8085 program to find minimum value of digit in the 8 bit number
- Minimum and Maximum Prime Numbers of a Singly Linked List in C++.

- 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 maximum and minimum number in a block data.

Write 8085 Assembly language program to find the maximum and minimum number in a block often 8-bit numbers.

In this program we are taking the first number of the block into register D and E. The D will store the minimum number, and E will store maximum number. In each iteration we will check whether the number is smaller than D or not, if it is smaller, then update D with the new number, and then compare it again with E to check whether the number is larger than E or not. If larger, then update E with the new number.

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

. . . | . . . |

8000 | 55 |

8001 | 22 |

8002 | 88 |

8003 | 77 |

8004 | 11 |

8005 | 99 |

8006 | 44 |

8007 | AA |

8008 | 33 |

8009 | 66 |

. . . | . . . |

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

F000 | 21, 00, 80 | LXI H,8000H | Load the initial address | |

F003 | 0E, 0A | MVI C,0AH | Load the count of numbers | |

F005 | 56 | MOV D,M | Load the first number from memory | |

F006 | 5A | MOV E,D | Also load the first number to E | |

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

F008 | 0D | DCR C | Decrease the count | |

F009 | 7E | LOOP | MOV A,M | Load the number from memory to A |

F00A | BA | CMP D | Compare D with A | |

F00B | D2, 0F, F0 | JNC SKIP | If CY = 0, A is not smaller | |

F00E | 57 | MOV D,A | Update D with A | |

F00F | BB | SKIP | CMP E | Compare E with A |

F010 | DA, 14, F0 | JC DO | if CY = 1, A is not larger | |

F013 | 5F | MOV E,A | Update E with A | |

F014 | 23 | DO | INX H | Point to next location |

F015 | 0D | DCR C | Decrease C by1 | |

F016 | C2, 09, F0 | JNZ LOOP | Go to loop | |

F019 | 21, 50, 80 | LXI H,8050H | Point to destination address | |

F01C | 72 | MOV M,D | Store the smallest number | |

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

F01E | 73 | MOV M,E | Store the largest number | |

F01F | 76 | HLT | Terminate the program |

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

. . . | . . . |

8050 | 11 |

8051 | AA |

. . . | . . . |

Advertisements