- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Program to Find the smallest number in an array of data in 8085 Microprocessor
In this program we will see how to find the smallest number from a block of bytes using 8085.
Problem Statement
Write 8085 Assembly language program to find the smallest number from a block of bytes.
Discussion
In this program the data are stored at location 8001H onwards. The 8000H is containing the size of the block. After executing this program, it will return the smallest number and store it at location 9000H.
Logic is simple, we are taking the first number at register B to start the job. In each iteration we are getting the number from memory and storing it into register A. Then if B > A, then we simply update the value of Bwith A, otherwise go for the next iteration. Thus we can find the smallest number in a block of bytes.
Input
Address | Data |
---|---|
... | ... |
8000 | 06 |
8001 | 55 |
8002 | 22 |
8003 | 44 |
8004 | 11 |
8005 | 33 |
8006 | 66 |
... | ... |
Flow Diagram
Program
Address | HEX Codes | Labels | Mnemonics | Comments |
---|---|---|---|---|
F000 | 21, 00, 80 | LXI H,8000H | Point to get array size | |
F003 | 4E | MOV C, M | Get the size of array | |
F004 | 23 | INX H | Point to actual array | |
F005 | 46 | MOV B, M | Load the first number into B | |
F006 | 0D | DCR C | Decrease C | |
F007 | 23 | LOOP | INX H | Point to next location |
F008 | 7E | MOV A, M | Get the next number from memory to Acc | |
F009 | B8 | CMP B | Compare Acc and B | |
F00A | D2, 0E, F0 | JNC SKIP | if B <= A,then skip | |
F00D | 47 | MOV B, A | If CY is 1, update B | |
F00E | 0D | SKIP | DCR C | Decrease C |
F00F | C2, 07, F0 | JNZ LOOP | When count is not 0, go to LOOP | |
F012 | 21, 00, 90 | LXI H,9000H | Point to destination address | |
F015 | 70 | MOV M, B | Store the minimum number | |
F016 | 76 | HLT | Terminate the program |
Output
Address | Data |
---|---|
... | ... |
9000 | 11 |
... | ... |
- Related Articles
- Program to Find the largest number in an array of data in 8085 Microprocessor
- 8085 Program to find the smallest number
- Java program to find the smallest number in an array
- Java program to find the 2nd smallest number in an array
- 8085 Assembly language program to find largest number in an array
- 8085 program to find smallest number between two numbers
- Number of instructions in 8085 Microprocessor
- Program to find the Square of a number using a look-up table in 8085 Microprocessor
- Program to find the HCF of two given bytes in 8085 Microprocessor
- Data file mode in 8085 Microprocessor
- Address/data buffers in 8085 Microprocessor
- Program to alternately display 00 and FF in the data field in 8085 Microprocessor
- 8085 program to search a number in an array of n numbers
- Program to compute LCM in 8085 Microprocessor
- Java program to find Largest, Smallest, Second Largest, Second Smallest in an array

Advertisements