DESCENDING ORDER
Aim: - To write assembly language programs to find the descending order of the given series of numbers.
Registers: - AL, BX, CL and DX
Description: - Arranging the given series of numbers in ascending order and the result is stored in corresponding pointer.
Ports:- None.
DATA SEGMENT
A DB 5 DUP (0)
DATA ENDS
CODE SEGMENT
ASSUME CS: CODE, DS: DATA
START:
MOV CL, 05
MOV DL, 05
DEC CL
L1: MOV BX, 00
L2: MOV AL, A[BX]
CMP AL , A[BX+1]
JA L3
XCHG AL , A[BX+1]
MOV A[BX], AL
L3: INCBX
MOV DL, CL
DEC DL
CODE ENDS
END START
Result:- Descending order of given series of numbers is found.
No comments:
Post a Comment