谢谢你!!!
哎呀!现在我还是觉得迷糊:我们是输入一个一个的字符(当然可以转换成ASCII 码,看成是一个数),到底怎样从键盘上输入一个如:1234H 的数啊????
[此贴子已经被作者于2006-12-21 20:01:58编辑过]
DATA SEGMENT
TABLE DW 41H,58H,42H,50H,5AH,44H,55H,42H,'$'
LEN DW 16
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE, DS:DATA
MAIN PROC FAR
PUSH DS
MOV AX,0
PUSH AX
MOV AX, DATA
MOV DS, AX
CALL FAR PTR DISP
MOV DL, 0DH ;DISPLAY THE NEW LINE
MOV AH, 2
INT 21H
MOV DL, 0AH
MOV AH, 2
INT 21H
LP1: MOV BX, 1 ;SET FLAG, IF 1, NOT FINISHED
MOV CX, LEN ;TIMES OF INTERATION
DEC CX
MOV SI, OFFSET TABLE
LP2: MOV AX, [SI]
CMP AX, [SI+2]
JBE NEXT
XCHG AX, [SI+2]
MOV [SI], AX
XOR BX, BX ;IF XCHG HAPPENS, SET BX TO 0
NEXT: ADD SI, 2
LOOP LP2
DEC LEN
CMP BX, 1
JNZ LP1
JMP SHORT EXIT
DISP: MOV DX, OFFSET TABLE
MOV AH, 9
INT 21H
RET
EXIT: CALL FAR PTR DISP
MOV AX, 4C00H
INT 21H
MAIN ENDP
CODE ENDS
END MAIN
程序是把字母输出并排序,但是运行时却有错误,请问错在哪里呢?