Professional Documents
Culture Documents
Aim:
To perform the ascending, descending, largest and smallest number from the
given array using 8086 processor by MASM 611 assembler.
Tool Used:
Algorithm:
1. Inside the data segment create an array (size N) and end it.
(a) For Ascending:if positive then exchanging the values in it else leave it as
usual and skip to next address of the array by increasing SI and decreasing CL.
And then repeat the steps 5-6. (use JC)
(b) For Descending: if negative then exchanging the values in it else leaveit as
usual and skip to next address of the array by increasing SI and decreasing CL.
And then repeat the steps 5-6. (use JNC)
8. The largest and smallest number of the array is the first element of the
descending and ascending array respectively.
Program:
Procedure:
1) Mount c c:\MASM611
2) c:
3) cd bin
4) edit filename.asm
5) masm filename.asm
6) link filename.obj
7) debug filename.exe
8) -u
-r
-g
-d DS: 0000 0004 //sorted array
-d DS: 0000 //smallest (or) largest number
-q
These are the commands used during Lab Class while executing the ALP in DOS
prompt
Sample Input:
Sample Output:
48
98
Ascending and smallest: AX=FFFF, BX=0000 & DS=0754 and AX=0765, BX=0098
& DS=0764 after operation
Descending and largest: AX=FFFF, BX=0000 & DS=0754 and AX=0750, BX=0048
& DS=0764 after operation
Result:
Hence, sorting in ascending and descending and finding the smallest and
largest element in an array are verified using the MASM application using
DOSBOX.