编写一个将10个8位带符号数进行排序的程序。 DSG SEGMENT
DATA DB 2,-6,4,1,5,-12,7,87,14,-21
DSG ENDS
CSG SEGMENT
ASSUME CS:CSG,DS:DSG
START: MOV AX,DSG
MOV DS,AX
LEA DI,DATA
MOV BX,9
NEXT1: MOV SI,DI
MOV CX,BX
NEXT2: MOV AL,[SI]
ADD SI,1
CMP AL,[SI]
JNL NEXT3
MOV DL,[SI]
MOV [SI-1],DL
MOV [SI],AL
NEXT3: DEC CX
JNZ NEXT2
DEC BX
JNZ NEXT1
HLT
CSG ENDS
END START
|