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.
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.
dosseg .model small .stack 100h .data array db 61h,43h,45h,42h,41h .code main proc mov ax,@data mov ds,ax mov cx,0005h mov si,offset array mov bl,[si] again: cmp bl,[si] jc nochange 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
0 Comments