Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;====== Программа 15. Файл z4_pr15.asm ====================
- masm
- model tiny
- .code
- org 100h
- start:
- call print_arr
- mov cx,len
- dec cx
- mov bx,0
- .outer:
- push cx
- mov cx,len
- sub cx,bx
- dec cx
- mov si,bx
- mov di,bx ;индекс минимального элемента в данной итерации
- mov dl,array[di]
- .inner:
- inc si
- cmp dl,array[si]
- jng .body
- mov di,si
- mov dl,array[di]
- .body:
- loop .inner
- cmp di,bx
- je .continue
- xchg array[bx], dl
- mov array[di], dl
- .continue:
- inc bx
- pop cx
- loop .outer
- pop cx
- call print_arr
- .exit:
- mov ax,4c00h
- int 21h
- print_arr proc
- mov cx,len
- mov bx,0
- .l:
- mov dl,array[bx]
- or dl,30h
- mov ah,02h
- int 21h
- mov dl, 20h
- int 21h
- inc bx
- loop .l
- .endl:
- mov dl,10
- int 21h
- ret
- print_arr endp
- array db 1,9,8,5,2,0,7,4,3,6
- len equ $-array
- end start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement