汇编语言编写程序
发布网友
发布时间:2022-04-22 05:06
我来回答
共1个回答
热心网友
时间:2023-04-26 13:51
DATA SEGMENT
ARRAY DB 100
DB ?
DB 100 DUP(?)
BUF1 DB 'Please input string : $'
BUF2 DB 'The order is : $'
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE, DS:DATA
MAIN PROC
MOV AX, DATA
MOV DS, AX
MOV DX, OFFSET BUF1
MOV AH, 09H
INT 21H
MOV DX, OFFSET ARRAY
MOV AH, 0AH
INT 21H
MOV CL, ARRAY + 1
MOV CH, 0
DEC CX
L1:
MOV DI, CX
MOV BX, 0
L2:
MOV AL, [ARRAY + BX + 2]
CMP AL, [ARRAY + BX + 3]
JBE CONTINUE
XCHG AL, [ARRAY + BX + 3]
MOV [ARRAY + BX + 2], AL
CONTINUE:
INC BX
LOOP L2
MOV CX, DI
LOOP L1
MOV BL, ARRAY + 1
MOV BH, 0
MOV [ARRAY + BX + 2], '$'
MOV AH, 2
MOV DL, 13
INT 21H
MOV DL, 10
INT 21H
CALL NEAR PTR CURS
MOV DX, OFFSET BUF2
MOV AH, 09H
INT 21H
MOV DX, OFFSET ARRAY
ADD DX, 2
MOV AH, 09H
INT 21H
EXIT:
MOV AH, 4CH
INT 21H
MAIN ENDP
CURS PROC NEAR
MOV AL, 02H
MOV BH, 00H
MOV DH, 03H
MOV DL, 00H
INT 10H
RET
CURS ENDP
CODE ENDS
END MAIN
可以了。
追问谢谢!!请问,如果要指定数据从1000H开始存放怎么办?