8086 Assembly Language Program To Find The Smallest Number In An Array

 8086 assembly language program to find the smallest number in an array- This 8086 assembly programme will find the smallest number from the array provided.

program to find the smallest number in 8086

How it works?

At first, initialize the array at the data segment, and create a variable small also. Then initialise data segment and move offset array to si register and move first array element to bl register as shown in the program to find the smallest number in an array in 8086. Here we will compare the content of the bl and [si] register and check the carry register. if carry is taken we get to know the content in bl is already the smallest number, here we will not do anything but if carry is taken we will move [si] to bl. We will continue this in the loop for every element in the array.

Here is the 8086 microprocessor program to find smallest number.

.model small
.stack 100h
array db 61h,43h,45h,42h,41h
main proc
mov ax,@data
mov ds,ax
mov cx,0005h
mov si,offset array
mov bl,[si]
cmp bl,[si]
jc nochange
inc si
loop again
mov small,bl
mov dl,small
mov ah,02h
int 21h
mova ah,4ch
int 21h
main endp
end main

This program to find the smallest number in 8086 is tested in masm and gives the correct output. If you have any query about this 8086 alp comment down below

Post a Comment