Sorting A Series of 10 Numbers: Flowchart

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

Exp.

No : 11 Date:
Venue: MPMC lab (A3 –TF10 Time:
backside) Branch/year:E2-ECE
ID.No: Section: SG-02
Name:
Sorting a series of 10 numbers

AIM:
TO Write an assembly language programme to SORT a series of a
10 numbers from 20,000H in ascending order using 8086.

APPARATUS
Sl.no Name of the Specification Quantity
equipment
1 Micro processor kit 8086 1
2 Power supply 5V, DC 1
3 Key board - 1

ALGORITHM:
1. Initia1lise segment address DS=2000H.

2. Initialise outer loop count of 9 in CH.

3. Initialise offset address SI=0000H.

4. Initialise inner loop count of 9 in CL.

5. Compare two adjacent numbers pointed by SI and SI+1.

6. If they are in correct order then leave them else interchange


them.

7. Repeat the inner loop CL times

8. Repeat the outer loop CH times.

9. Voila! The series is sorted.

FLOWCHART:
-
PROGRAM:
CODE SEGMENT
ASSUME CS:CODE
MOV AX,2000H
MOV DS,AX
MOV CH,09H
BCK2: MOV SI,0000H
MOV CL,09H
BCK1: MOV AX,[SI]
CMP AH,AL
JNC SKIP
XCHG AL,AH
MOV [SI],AX
SKIP: INC SI
DEC CH
JNZ BCK2
INT 03H
CODE ENDS
END

OUTPUT FOR SORTING:

INPUT
ADRESS DATA
20000 01
20001 05
20002 09
20003 07
20004 03
20005 06
20006 02
20007 04
20008 10
20009 08

OUPUT
ADRESS DATA
20000 01
20001 02
20002 03
20003 04
20004 05
20005 06
20006 07
20007 08
20008 09
20009 10

Result: Thus the assembly language program to perform sorting of series of


10 numbers using 8086 Performed and the result is stored.

You might also like