1 ; Ce programme prend 5 valeurs entières saisies par l'utilisateur
2 ; les stocke dans un tableau
4 ; affiche le contenu du tableau trié
7 ; le programme retourne une erreur si l'utilisateur ne saisie pas 5 entiers
8 ; Alexandre Terrasa (c) 2012
13 STA maxlen, d ; maxlen = A
17 saisie: DECI tab, x ; do { tab[X] = getInt()
20 BRLT saisie ; } while (X < len)
23 trie: LDA 1, i ; do { A = 1
24 STA flag, d ; flag = A // init le flag à false
28 loop: LDA tab, x ; A = tab[X]
30 ; comparer les valeurs
33 BRLE next ; if (A > tab[X]) {
34 ; // echanger les valeurs
36 LDA tab, x ; A = tab[x]
38 STA tab, x ; tab[x] = A
41 STA tab, x ; tab[x] = A
44 STA flag, d ; flag = A
48 BRLT loop ; } while(X < maxlen)
50 LDA flag, d ; A = flag
52 BREQ trie ; } while(flag == 0)
54 ; affichage le tableau
56 aff: DECO tab, x ; do { print (tab[X])
59 BRLT aff ; } while (X < len)
63 tab: .BLOCK 10 ; #2d5a tableau d'entiers
64 len: .EQUATE 10 ; taille du tableau
65 maxlen: .BLOCK 2 ; #2d case max - 1
66 flag: .BLOCK 2 ; #2d flag 'aucun_echange'
67 tmp: .BLOCK 2 ; #2d variable temporaire pour les permutations