这是老师布置得题,大家帮以下忙
;code by lys
assume cs:codesg,ds:datasg,ss:stack
datasg segment
s dw 1,3,8,5,-1,2,7,9,4,6
datasg ends
stack segment
dw 0,0,0,0,0,0
stack ends
codesg segment
start: mov ax,datasg
mov ds,ax
mov ax,stack
mov ss,ax
mov sp,12
mov cx,LENGTHOF s -1
L1: push cx
mov bx,0
mov cx,LENGTHOF s -1 ;这里cx=字符个数-1 !
L2:
mov ax,[bx]
cmp ax,[bx+2]
jle C1 ;有符号数用g,l 无符号数用a,b
xchg ax,[bx+2]
mov [bx],ax
C1:
add bx,2
loop L2
pop cx
loop L1
mov ax,4c00h
int 21h
codesg ends
end start
转载的哈, 你慢慢看...