请高手编个汇编程序
来源:百度知道 编辑:UC知道 时间:2024/05/07 02:36:51
16位!谢谢
1.
DSEG SEGMENT
count db 20
num dw 32h,4h,7h,9h,3h,2h,1h,5h,6h,7h,8h,9h,10h,12h,23h,43h,45h,67h,76h,44h
DSEG ENDS
CSEG SEGMENT
assume cs:CSEG, ds:DSEG
MAIN PROC FAR ;主程序入口
mov ax, dseg
mov ds, ax
mov cx,count
dec cx
loop1: mov di,cx
mov bx,0
loop2: mov ax,num[bx]
cmp ax,num[bx+2]
jle continue
xchg ax,num[bx+2]
mov num[bx],ax
continue: add bx,2
loop loop2
mov cx,di
loop loop1
;按任意键退出
mov ah,1
int 21h
mov ax, 4c00h ;程序结束,返回到操作系统系统
int 21h
MAIN ENDP
CSEG ENDS
END MAIN
2.
DSEG SEGMENT
count db 20
num dw 32h,4h,7h,9h,3h,2h,1h,5h,6h,7h,8h,9h,10h,12h,23h,43h,45h,67h,76h,44h
DSEG ENDS
CSEG SEGMENT
assume cs:CSEG, ds:DSEG
MAIN PROC FAR ;主程序入口
mov ax, dseg
mov ds, ax
mov cx,count
dec cx
loop1: mov di,cx
mov bx,0
loop2: mov ax,num[