1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
| Assume cs:code, ds:data
data segment
n dw ?
tab db 100
msg db 'donner la taille du tableau$'
message db 'donner les elements du tableau$'
max db ?
data ends
code segment
main:
taille:
mov dl,msg
mov ah,9
int 21h
mov ah,8
int 21h
mov ah,0
mov n,ax
jmp remplissage
remplissage:
mov si,0
rempli:
mov dl,message
mov ah,9
int 21h
mov ah,8
int 21h
mov tab[si],al
inc si
cmp si,n
jne rempli
trier:
mov si,0
mov bx,offset tab
d: mov cx,n
mov di,bx
inc di
jmp wd
wd:
mov al,tab[bx]
cmp al,tab[di]
ja tri
tri:
mov max,al
mov tab[di],al
mov al,max
inc di
loop wd
inc si
inc bx
cmp si,n
jne d
mov cx,n
mov bx,offset tab
affichage: mov dl,tab[bx]
mov ah,2
int 21h
inc bx
loop affichage
jmp fin
fin: mov ah,4ch
int 21h
code ends
end main |
Partager