上机练习4.7
.model small
.stack
.data
array DB 56h,23h,37h,78h,0ffh,0,12h,99h,64h,0b0h
DB 78h,80h,23h,1,4,0fh,2ah,46h,32h,42h
count EQU $-array
flag DB 1
.code
main PROC
mov ax,@data
mov ds,ax
mov cx,count
dec cx
OUTLP:
mov dx,cx
mov bx,OFFSET array
mov al,1
mov flag,al
INLP:
mov al,[bx]
cmp al,[bx+1]
jnb NEXT
xchg al,[bx+1]
mov [bx],al
mov al,0
mov flag,al
NEXT:
inc bx
dec dx
jnz INLP
cmp flag,0
jnz QUIT
loop OUTLP
QUIT:
mov ax,4c00h
int 21h
main ENDP
END main