Micro-Project: Title: Sort The Array in Descending Order Description
Micro-Project: Title: Sort The Array in Descending Order Description
Micro-Project: Title: Sort The Array in Descending Order Description
Report
Title: Sort the array in descending order
Brief Description:
Introduction:
1
Aim of Project:
The aim of the project is to understand how the array can be sorted into
descending order.
Literature Review:
1. Formation of groups.
3. Prepared proposal.
4. Collection of information.
2
Actual Resource Used:
3
ALP
Data Segment
Arr DB 04H,02H,09H,08H
Data Ends
Code Segment
Assume CS:Code, DS:Data
Start: Mov AX,Data
Mov DS,AX
Mov CH,03H
UP1: LEA SI,Arr
Mov CL,03
UP: Mov AL,[SI]
Inc SI
Cmp Al,[SI]
JC DN
Mov AH,[SI]
Mov [SI],AH
Dec SI
Mov [SI],AH
Inc SI
DN: Dec CL
JNZ UP
DEC CH
JNZ UP1
Code Ends
End Start
4
Algorithm:
Step 1: Start
Step 2: Initialize the CH resistor with 03H
Step 3: Load effective address of Arr into SI
Step 4: Initialize the CL resistor with 03H
Step 5: Store the content of SI into AL
Step 6: SI = SI+1
Step 7: Compare AL with value of SI
Step 8: if carry = 1
Goto step no. 12
Else
Exchange the value of AH and content of SI
Step 9: SI = SI-1
Step 10: Store the content of SI into AH
Step 11: SI = SI+1
Step 12: CL = CL-1
Step 13: If CL != 0
Goto step no 5
Else
CH = CH-1
Step 14: If CH != 0
Goto step no 3
Step 15: End
Instructions used:
5
Flowchart:
Start
SI = SI + 1
True
Carry = 1
False
Exchange the value of AH and content of SI
SI = SI - 1
SI = SI + 1
CL = CL-1
True
CL != 0
False
CH = CH - 1
True
CH != 0
False
Stop
6
Output: