MCSL
017
MCA
1st semester
Section
2: Assembly Language Programming Lab
(d) Write a program in assembly language for finding the largest number in an array of 10 elements.
DATA SEGMENT
ARR DB 1,4,2,3,9,8,6,7,5,10
LEN DW $-ARR
LARGE DB ?
DATA ENDS
CODE SEGMENT
ASSUME DS:DATA CS:CODE
START:
MOV AX,DATA
MOV DS,AX
LEA SI,ARR
MOV AL,ARR[SI]
MOV LARGE,AL
MOV CX,LEN
REPEAT:
MOV AL,ARR[SI]
CMP LARGE,AL
JG NOCHANGE
MOV LARGE,AL
NOCHANGE:
INC SI
LOOP REPEAT
MOV AH,4CH
INT 21H
CODE ENDS
END START
No comments:
Post a Comment