.MODEL SMALL
.STACK 100H
.DATA
ARR DB 5 DUP(0)
BIG DB ?
.CODE
MAIN PROC
MOV CX,5
MOV AH,01
MOV SI,0
L1:
INT 21H
MOV [ARR+SI],AL
INC SI
LOOP L1
MOV CX,5
MOV SI,0
MOV AL,[ARR+0]
MOV BIG,BL
L2:
CMP AL,[ARR+SI]
JL SWAP
BCK:
INC SI
LOOP L2
JMP END_OF_PROG
SWAP:
MOV BL,AL
MOV AL,[ARR+SI]
MOV [ARR+SI],BL
MOV BIG,BL
JMP BCK
END_OF_PROG:
MOV DL,BIG
MOV AH,02
INT 21H
MOV AH,4CH
INT 21H
MAIN ENDP
END MAIN
.STACK 100H
.DATA
ARR DB 5 DUP(0)
BIG DB ?
.CODE
MAIN PROC
MOV CX,5
MOV AH,01
MOV SI,0
L1:
INT 21H
MOV [ARR+SI],AL
INC SI
LOOP L1
MOV CX,5
MOV SI,0
MOV AL,[ARR+0]
MOV BIG,BL
L2:
CMP AL,[ARR+SI]
JL SWAP
BCK:
INC SI
LOOP L2
JMP END_OF_PROG
SWAP:
MOV BL,AL
MOV AL,[ARR+SI]
MOV [ARR+SI],BL
MOV BIG,BL
JMP BCK
END_OF_PROG:
MOV DL,BIG
MOV AH,02
INT 21H
MOV AH,4CH
INT 21H
MAIN ENDP
END MAIN
Comments
Post a Comment