如何用汇编语言实现排序

来源:百度知道 编辑:UC知道 时间:2024/06/17 16:26:01
题目如下:键盘输入10个无符号数(长度为2字节,自己设计具体值,应包括2位和3位数值),将其保存在内存中并显示在屏幕上,再由小到大排序,将结果保存到内存中并显示在屏幕上

;此程序也支持有符号数
.286
.model small
;---------------------------------------------------------------
.code
start:
push cs
pop ds
push cs
pop es

mov ah,09h
mov dx,offset msg1
int 21h

;输入功能从这里开始
mov dx,offset InputBuffer
sub bx,bx
mov ah,3fh
mov cx,80h
int 21h

mov si,offset InputBuffer
mov di,offset numbers
sub ax,ax
mov cx,0ah

@InputLoop:
sub bx,bx
sub