( Прога поизводит пузырьковую сортировку ошибка в выводе)
model small
stack 100h
.data
elm dw ?
elm1 db 0
elm2 db 0
deset db 10
mas db 51,72,95,21,36
n=$-mas
x db 0
.code
start:
mov ax,@data
mov ds,ax
; sortirovka
mov cx,n-1
mov si,1
cikl1:
push cx
mov cx,n
sub cx,si
push si
mov si,n-1
cikl2:
mov al,mas[si-1]
cmp mas[si],al
ja m1
mov x,al
mov al,mas[si]
mov mas[si-1],al
mov al,x
mov mas[si],al
m1:
dec si
loop cikl2
pop si
inc si
pop cx
loop cikl1
;vivod
mov cx,5
mov si,0
cikl3:
sub ah,ah
sub al,al
mov ax,mas[si]
div deset
mov elm1,al
mov elm2,ah
;vivod pervoi 4asti elementa
mov dl,elm1
mov ah,02h
add dl,30h
int 21h
;vivod vtoroi 4asti elementa
mov dl,elm2
mov ah,02h
add dl,30h
int 21h
inc si
loop cikl3
;konec
mov ax,4c00h
int 21h
end start