You are on page 1of 3

EXP.

NO: SORTING THE DATA IN DESCENDING ORDER


DATE:

AIM:
To learn to write an assembly language program for performing sorting the given N data in
descending order using 8085.

APPARATUS REQUIRED:

1. 8085 microprocessor kit.


2. Power chord.

ALGORITHM:
a. Start the program.
b. Enter the number to be arranged in descending order in one memory locations.
c. Compare the two data.
d. Store the descending order in another memory location.
e. Store the result and stop the program.

FLOW CHART:
PROGRAM:

ADDRESS OPCODE LABEL MNEMONICS COMMENTS


4100 AF START XRA A ;Clear the accumulator
4101 06 L1 MVI B ,00H ;Store the data 00 in B
4102 00
4103 21 LXIH,4300 H ;load the HL pair into 4300 H
4104 00
4105 43
4106 4E MOV C,M ;Store the content of M in C
;Decrement the content of C
4107 0D DCR C ;register
4108 23 INX H ;Increment the HL pair
4109 7E L2 MOV A,M ;Store the content of M in A
410A 23 INX H ;Increment the HL pair
;Compare the content of M
410B BE CMD M ;with A
410C D2 JNC L3 ;Jump on no carry to L3
410D 16
410E 41
410F 56 MOV D,M ;Store the content of M in D
4110 77 MOV M,A ;Store the content of A in B
4111 2B DCX H ;Decrement the content HL
4112 72 MOV M,D ;Store the content of M from D
4113 23 INX H ;Increment the HL pair
4114 06 MVI B, 01 H ;Store the data 01 in B
4115 01
4116 0D L3 DCR C ;Decrement the C register
4117 C2 JNC L2 ;Jump on no carry to L2
4118 09
4119 41
411A 05 DCR B ;Decrement B register
411B CA JZ L1 ;Jump on zero to L1
411C 01
411D 41
411E 76 HLT ;Stop the execution
MANUAL CALCULATION:

ADDRESS DATA

Input:

4300 H 04 H(COUNT VAUE)


4301 H 56 H
4302 H 79 H
4303 H 15 H
4304 H 21 H

Output:
4300 H 04 H(COUNT VAUE)
4301 H 79 H
4302 H 56 H
4303 H 21 H
4304 H 15 H

RESULT:
Thus the assembly language program for descending order for given N data using
8085 is performed and the output is justified.

You might also like