0% found this document useful (0 votes)
10 views5 pages

Microprocessor PDF

Uploaded by

sanjays66869
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views5 pages

Microprocessor PDF

Uploaded by

sanjays66869
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

19EC408 – MICROPROCESSOR AND MICROCONTROLLER

ASSIGNMENT – 1

TOPIC : WRITE AN ALP TO FIND SMALLEST NO FROM THE GIVEN ARRAY

NAME : DILIP KUMAR R


DEPT : COMPUTER SCIENCE AND ENGINEERING
YEAR : 3rd YEAR
REG NO : 212222040037
8086 Assembly Program to Find the Smallest Number from an Array

AIM :

To write an 8086 Assembly language program that finds the smallest


number from a given array using DOSBox.

ALGORITHM :

• Initialize the Data Segment.


• Load the address of the array into the source index register
(SI).
• Initialize the counter (CX) with the number of elements in the
array.
• Assume the first element as the smallest and store it in the
BL register.
• Compare each element of the array with the value in BL.
• If an element is smaller, store it in BL.
• Repeat this process for all elements in the array using a loop.
• Store the smallest value in the result variable.
• Display the result using DOS interrupt 21h.
• End the program.
PROGRAM :

dosseg
.model small
.data

array db 1,2,3,4,5
result db ?

.code
main proc

mov ax,@data
mov ds,ax

mov cx,5
mov bl,79h
lea si,array
l1:
mov al,[si]
cmp al,bl
jge l2
mov bl,al
l2:
inc si

dec cx
jnz l1
mov result,bl
mov dl,48
mov ah,2
int 21h
mov ah,4ch
int 21h

main endp
end main
OUTPUT :

RESULT :

The program successfully finds the smallest number from the given array and displays it.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy