排序

DATA SEGMENT
BUF DB 12,45,78,64,34,12,56,75
CNT EQU $-BUF
RESULT DB CNT DUP(?)
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
BEGIN: MOV AX,DATA
MOV DS,AX
MOV BX,CNT
DEC BX
MOV CX,BX
NEXT1: MOV DI,OFFSET BUF
NEXT2: CMP [DI],[DI+1]
JA BIG
JMP SMALL
BIG: XCHG [DI],[DI+1]
SMALL: INC DI
LOOP NEXT2
DEC BX
MOV CX,BX
LOOP NEXT1
MOV AH,4CH
INT 21H
CODE ENDS
END BEGIN

你可能感兴趣的:(排序)