(2)、源代码
DATAS SEGMENT BUF DB 40
DB ? DB 40 DUP(0) SHUZI DB 10 DUP(0) BIAO DW 0
STRING DB 'input 10 numbers:$' DATAS ENDS
STACKS SEGMENT
STA DW 20H DUP(0) STACKS ENDS
CODES SEGMENT
ASSUME CS:CODES,DS:DATAS,SS:STACKS START:
main proc far MOV AX,DATAS MOV DS,AX MOV AX,STACKS MOV SS,AX
LEA BX,STRING ;输出 CALL output CALL HUICHE
CALL input ;输入10个十进制数 CALL HUICHE
CALL change ;将ASCII码转换 CALL paixu ;将其排序 LEA SI,BUF ADD SI,5 MOV DI,10 ABC:
MOV AL,[SI]
CALL output16 ;将16进制数输出 CALL kongge ADD SI,3 DEC DI JNZ ABC MOV AH,4CH INT 21H main endp
output proc near ;输出字符串 MOV DX,BX MOV AH,09H INT 21H RET
output endp
input proc near ;输入字符串 LEA DX,BUF MOV AH,0AH INT 21H RET input endp
HUICHE proc near ;回车换行 MOV DL,0DH MOV AH,02H INT 21H MOV DL,0AH MOV AH,02H INT 21H RET
HUICHE endp
change proc near ;ASCII码转换 LEA SI,BUF ADD SI,2 MOV CX,10 L1:
AND BYTE PTR [SI],0FH INC SI
AND BYTE PTR [SI],0FH ADD SI,2
LOOP L1 ;变成十进制 LEA SI,BUF ADD SI,2 MOV BL,10