1.题目要求:
在缓冲区VAR中连续存放着3个16位的无符号数,编写程序实现将其按递增关系排列。
STACK SEGMENT STACK'STACK'
DW 100H DUP(?)
TOP LABEL WORD
STACK ENDS
DATA SEGMENT
VAR DW 1046H,1215H,11A2H
VAR1 DW (?)
VAR2 DW (?)
VAR3 DW (?)
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA,ES:DATA,SS:STACK
START:
MOV AX,DATA
MOV DS,AX
MOV AX,VAR
MOV BX,VAR+2
MOV CX,VAR+4
CMP AX,BX
JAE CHG1
XCHG AX,BX
CHG1:
CMP AX,CX
JAE CHG2
XCHG AX,CX
CHG2:
MOV VAR+4,AX
MOV AX,BX
CMP AX,CX
JAE CHG3
XCHG AX,CX
MOV VAR+2,AX
CHG3:
MOV VAR,CX
MOV AH,4CH
INT 21H
CODE ENDS
END START