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
| Data SEGMENT
code segment
assume cs:code , ds:data
mov ax ,data
mov ds, ax
TAB db "7","9","4","0","6"
TEMP db 0
DATA ENDS
CODE SEGMENT
DEBUT:MOV SI,offset TAB ; si pointe sur le debut du tableau
inc si
mov di,si
COM:CMP TAB[SI],TAB[DI]
JL PERMUTE
CMP TAB[DI], TAB[offset TAB +4]
JE COM2
INC DI
JMP COM
COM2:CMP [SI],offset [TAB+4]
JE AFFICHAGE
INC SI
MOV si
MOV di,si
PERMUTE:MOV TEMP,TAB[DI]
MOV TAB[DI],TAB[SI]
TAB[SI],TEMP
JMP COM
AFFICHAGE:MOV si,offset TAB
MOV AH,TAB[SI]
JE FIN
MOV DL,AL
MOV AH,2
INT 21H
INC SI
JMP AFFICHAGE
FIN:MOV AH,4CH
INT 21H
ENDS
end DEBUT |
Partager